Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's able to write bytes up to 512KB after sftp server is down #32

Open
metalpalo opened this issue Feb 11, 2021 · 0 comments
Open

It's able to write bytes up to 512KB after sftp server is down #32

metalpalo opened this issue Feb 11, 2021 · 0 comments

Comments

@metalpalo
Copy link

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.

  1. start sftp server
  2. start upload bytes after successful connection, I see that data are sent in mentioned size of packet.
  3. 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
  1. byte uploading still continue up to cca 512Kb without any exception
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant