It's able to write bytes up to 512KB after sftp server is down
metalpalo opened this issue · 0 comments
metalpalo commented
Hi,
I used spring integration sftp SftpRemoteFileTemplate to upload file. It uses internally jsch library, concretely I see version 0.1.54.
To upload I use piping via PipeOutputStream<->PipeInputStream, that means bytes received from inputstream are sent to sft server in cca 32768B large packets what I understood. But this situation I don't.
My test case.
- start sftp server
- start upload bytes after successful connection, I see that data are sent in mentioned size of packet.
- shutdown sftp server, I received immediately following log:
INFO com.jcraft.jsch - Caught an exception, leaving main loop due to Connection reset
INFO com.jcraft.jsch - Disconnecting from localhost port 3373
- byte uploading still continue up to cca 512Kb without any exception
- finally I got following exception:
Caused by: com.jcraft.jsch.SftpException: java.io.IOException: Pipe closed
at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:697) ~[jsch-0.1.54.jar:na]
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:540) ~[jsch-0.1.54.jar:na]
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:492) ~[jsch-0.1.54.jar:na]
at org.springframework.integration.sftp.session.SftpSession.write(SftpSession.java:155) ~[spring-integration-sftp-5.1.9.RELEASE.jar:5.1.9.RELEASE]
... 12 common frames omitted
Caused by: java.io.IOException: Pipe closed
at java.base/java.io.PipedInputStream.read(PipedInputStream.java:307) ~[na:na]
at java.base/java.io.PipedInputStream.read(PipedInputStream.java:377) ~[na:na]
at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2909) ~[jsch-0.1.54.jar:na]
at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2935) ~[jsch-0.1.54.jar:na]
at com.jcraft.jsch.ChannelSftp.checkStatus(ChannelSftp.java:2473) ~[jsch-0.1.54.jar:na]
at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:651) ~[jsch-0.1.54.jar:na]
... 15 common frames omitted
My question is: Why am I able to put so many data after connection is closed? Is possible to configure something?
I would like to receive error as soon as possible in order to stop data producing.
thanks