Results 1 to 7 of 7

Thread: getting "Pipe closed" exceptions with SFTP adapter

  1. #1
    Join Date
    Apr 2012
    Posts
    16

    Default getting "Pipe closed" exceptions with SFTP adapter

    Hi,

    I'm using spring-integration 2.1 with SFTP adapter component to transfer files to a remote location.
    Intermittently, I'm getting the following exception:
    Code:
    Error handling message for file [20120621143000.TKT.gpg.tmp]_  _org.springframework.integration.MessageDeliveryException: Error handling message for file [/20120621143000.TKT.gpg.tmp]
    ... stack was trimmed to be contained in a single post...
    Caused by: org.springframework.integration.MessagingException: Failed to write to '/dest/20120621143000.TKT.gpg.writing' while uploading the file
          at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.sendFileToRemoteDirectory(FileTransferringMessageHandler.java:227)
          at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.handleMessageInternal(FileTransferringMessageHandler.java:136)
          ... 225 more
    Caused by: org.springframework.core.NestedIOException: failed to write file; nested exception is 4: java.io.IOException: Pipe closed
          at org.springframework.integration.sftp.session.SftpSession.write(SftpSession.java:109)
          at org.springframework.integration.file.remote.session.CachingSessionFactory$CachedSession.write(CachingSessionFactory.java:147)
          at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.sendFileToRemoteDirectory(FileTransferringMessageHandler.java:222)
          ... 226 more
    Caused by: 4: java.io.IOException: Pipe closed
          at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:623)
          at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:480)
          at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:439)
          at org.springframework.integration.sftp.session.SftpSession.write(SftpSession.java:106)
          ... 228 more
    Caused by: java.io.IOException: Pipe closed
          at java.io.PipedInputStream.read(PipedInputStream.java:291)
          at com.jcraft.jsch.Channel$MyPipedInputStream.updateReadSide(Channel.java:397)
          at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:493)
          ... 231 more
    The org.springframework.integration.sftp.session.Defau ltSftpSessionFactory is configured with "enableDaemonThread" set to "true" due to another problem we have.
    I have seen posts dealing with this jcraft exception without an answer.
    Is this a known issue with the SFTP adapter? is there a solution for it?

    Thanks.

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,020

    Default

    Most likely this indicates the server closed the connection for some reason; I suggest you look at the server logs.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Mar 2010
    Location
    USA
    Posts
    119

    Default

    In this scenario, should the sessionFactory not have detected the invalid session (due to closed pipe) before even trying to send data on teh EFTP channel?

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,020

    Default

    Depends when it happened; the pipe might have closed mid-stream.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  5. #5
    Join Date
    Mar 2010
    Location
    USA
    Posts
    119

    Default

    Agree, But in our scenario (exactly similar to what is described here) (link

    Am seeing that this is very much reproducible every time and always occur after the 8 hours when the job is again triggered. Then in this case, Am I wrong in assuming that this should have been validated by the DefaultSessionFactory?

  6. #6
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,020

    Default

    Are you using a CachingConnectionFactory? If you are only using one session per 8 hours, you are not benefiting at all from a cache and, it is possible, the library doesn't detect a closed session until the next time it's used.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  7. #7
    Join Date
    Mar 2010
    Location
    USA
    Posts
    119

    Default

    We are using org.springframework.integration.sftp.session.Defau ltSftpSessionFactory. Could you please shed some light as to whether the CachingSessionFactory would work better or whether we do have that validation for a DefaultSftpSessionFactory?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •