Project

General

Profile

Exception occurs on data transfer from storage element

Added by Rotondo Riccardo almost 13 years ago

Dear developers,

I'm using jSaga API to transfer data from/to gLite storage element.

Despite the NSEnty method works fine for small files, it generates an exception for files larger than a fixed size.

The exception I get is the following:

[#|2011-12-19T17:10:34.019+0100|SEVERE|glassfish3.0.1|it.infn.ct.downloadFile|_ThreadID=25;_ThreadName=Thread-3;|The log message is null.
it.infn.ct.GridEngine.Data.DataError: java.io.IOException: java.io.IOException: class org.ogf.saga.error.NoSuccessException: org.globus.ftp.exception.UnexpectedReplyCodeException:  Custom message: Unexpected reply: 451 exception during TransferSinkThread
java.io.IOException: Pipe closed
java.io.IOException: Pipe closed
    at java.io.PipedInputStream.checkStateForReceive(PipedInputStream.java:244)
    at java.io.PipedInputStream.receive(PipedInputStream.java:210)
    at java.io.PipedOutputStream.write(PipedOutputStream.java:132)
    at org.globus.ftp.DataSinkStream.write(DataSinkStream.java:51)
    at org.globus.ftp.dc.TransferSinkThread.copy(TransferSinkThread.java:113)
    at org.globus.ftp.dc.TransferSinkThread.run(TransferSinkThread.java:68)

    at it.infn.ct.GridEngine.Data.JSagaDataManagement.copyFile(JSagaDataManagement.java:360)
    at it.infn.ct.dog.DOGS.download(DOGS.java:435)
    at it.infn.ct.downloadFile.processRequest(downloadFile.java:113)
    at it.infn.ct.downloadFile.doGet(downloadFile.java:193)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
    at java.lang.Thread.run(Thread.java:680)
|#]

This occurs during the transfer from the storage element to my machine and vice-versa. However the file is successfully transferred in my machine.

For this reason I implemented a not so elegant solution catching the exception and ignoring it with this code:

catch (NoSuccessException ex) {
            List <String> le = ex.getAllMessages();
            if (!le.get(le.size()-1).contains("451 exception during TransferSinkThread")) {
                log.error(ex);
                userTrackingDB.CloseGridInteraction(gIntAct);
                throw new DataError(ex.getMessage());
            }
            log.debug("DataTransfer ok: 451 " 
                    + "exception during TransferSinkThread");
        } 

I suspect is a problem of a Pipe being closed in the wrong moment.

Is this a known issue ?

Thank you for your help.

Regards.

Riccardo Rotondo


Replies (6)

RE: Exception occurs on data transfer from storage element - Added by Schwarz Lionel over 12 years ago

Hi Riccardo,
I have no idea what this error could be. I can try to reproduce your issue if you give me more information:
- what is the minimum file size from which you see the problem ?
- do you have the same issue with other storage elements ?

I'll have a look asap but not before beginning of next year.

regards
Lionel

RE: Exception occurs on data transfer from storage element - Added by Reynaud Sylvain over 12 years ago

Hi Riccardo,

Could you please also provide some piece of code to help us understand how JSAGA is used in your application, because your stack-trace does not contain any class from JSAGA (except the name of the embedding exception at the beginning of the stack-trace).

Thanks and Happy New Year,
Sylvain

RE: Exception occurs on data transfer from storage element - Added by Rotondo Riccardo over 12 years ago

Lionel Schwarz wrote:

Hi Riccardo,
I have no idea what this error could be. I can try to reproduce your issue if you give me more information:
- what is the minimum file size from which you see the problem ?

About 1000 byte

- do you have the same issue with other storage elements ?

Yes, my algorithm select a random storage elements among the one available for that VO

Thank you for your help

Riccardo

RE: Exception occurs on data transfer from storage element - Added by Rotondo Riccardo over 12 years ago

Sylvain Reynaud wrote:

Hi Riccardo,

Could you please also provide some piece of code to help us understand how JSAGA is used in your application, because your stack-trace does not contain any class from JSAGA (except the name of the embedding exception at the beginning of the stack-trace).

Here is the code we use both for upload and download where I had to catch the exception I mentioned. The code is not complete, I skipped pasting the part regarding the read/write on our database to trace grid interactions:


private String copyFile(URL source, URL destination, String commonName,
            String tcpAddress, int GridInteractionId, String userDescription)
            throws DataError {
        String absoluteStoragePath = null;
        Session session = sessionM.getSession();

try {
            NSEntry entrySource = NSFactory.createNSEntry(session, source);
            log.debug("NSEntry created");
            absoluteStoragePath = destination.getString();

            entrySource.copy(destination);
            log.debug("File copied to storage element!");

            entrySource.close();
            log.debug("NSEntry closed");

        } catch (AlreadyExistsException ex) {
            log.debug("File already exist, changing name");
            String newDestination = destination.getString() + "-1";
            log.debug("New file: " + newDestination);
            URL urlNewDestination = null;
            try {
                urlNewDestination = URLFactory.createURL(newDestination);
            } catch (BadParameterException ex1) {
                Logger.getLogger(JSagaDataManagement.class.getName()).
                        log(Level.SEVERE, null, ex1);
            } catch (NoSuccessException ex1) {
                Logger.getLogger(JSagaDataManagement.class.getName()).
                        log(Level.SEVERE, null, ex1);
            }
            absoluteStoragePath = copyFile(source, urlNewDestination, commonName,
                    tcpAddress, GridInteractionId, userDescription);

            } catch (NoSuccessException ex) {
                List <String> le = ex.getAllMessages();
                if (!le.get(le.size()-1).contains("451 exception during " 
                        + "TransferSinkThread")) {
                    log.error(ex);
                    userTrackingDB.CloseGridInteraction(gIntAct);
                    throw new DataError(ex.getMessage());
                }
                log.debug("DataTransfer ok: 451 " 
                        + "exception during TransferSinkThread");
            } catch (Exception ex) {
            log.error(ex);
            userTrackingDB.CloseGridInteraction(gIntAct);
            throw new DataError(ex.getMessage());
        }
        log.debug("Returning value " + absoluteStoragePath);
        return absoluteStoragePath;
    }

Thank you for your help.

Regards,

Riccardo

RE: Exception occurs on data transfer from storage element - Added by Schwarz Lionel over 12 years ago

Hi Riccardo,
Three things:
- why is there no any JSAGA trace in your stacktrace? Did you cut something between
at org.globus.ftp.dc.TransferSinkThread.run(TransferSinkThread.java:68)
and
at it.infn.ct.GridEngine.Data.JSagaDataManagement.copyFile(JSagaDataManagement.java:360)
?

- What are the source and destination URLs?

- we have build a new snapshot with some fixes in GridFTP adaptor and with upgrade to a more recent Globus API (JGlobus-1.8). Maybe you could try your code with this new snapshot.
http://grid.in2p3.fr/maven2/fr/in2p3/jsaga/jsaga-installer/0.9.15-SNAPSHOT/

Lionel

RE: Exception occurs on data transfer from storage element - Added by Schwarz Lionel over 12 years ago

Hi Riccardo,
I just had a deeper look at your code and it seems there is something wrong in your code. In the case of the destination file already exists, you catch the exception at

entrySource.copy(destination);

But the NSEntry is not closed. Your should close the NSEntry in all cases.

This error could explain your problem when the second try to copy the file (with destination name changed) is a bit longer (on larger files), the connection made at first try might be closed ("pipe closed") due to a timeout.

Hope this helps
Lionel

    (1-6/6)