Open vbedrosova opened 2 years ago
Hi @vbedrosova can you elaborate, what a regular scenario is for you?
I tried to reproduce an simple Exec
-example, but I did not come into exception block in https://github.com/mwiede/jsch/blob/master/src/main/java/com/jcraft/jsch/Session.java#L2018
From my point of view the logging level should be switched to ERROR
thow.
After each "Disconnecting from ..... port 22", I see "Caught an exception, leaving main loop due to Socket closed". It's an INFO level log message.
Hi @mwiede we are also facing this issue. Our scenario is quite simple :
The mix of INFO level log and worrying message is not comfortable. Could you have a look please ? Many thanks
Hi @mwiede any news about this? I've the same scenario as @zigzag75 mentioned.
I have the same problem as @zigzag75 . I do also ask for any news about this
We are also getting the same issue, however our Authentication works in an irregular way. Sometimes we can login into Server sometimes we can not, first assuming this is a Problem on Server side..
Yes, same error. With me, every alternate call to upload a file to SFTP is failing with the above-mentioned message and the very next call(after failure) to upload the same document is creating a new connection and uploads the file successfully.
Yes, same error occurs on every disconnect of SFTP connection on port 22. the version we are using is 0.1.62 in our application
Regards, Karan
@mwiede Hi IMHO: This is due to the incorrect implementation of the Session thread stopping in Session.disconnect() This method does not wait main "while-loop" exiting in Session.run(). It closes all resources (including socket), but thread is still working. I think you should wait until "while-loop" exiting and thread stopping after "isConnected = false;" or "thread = null;". And only then close all resources (IO, Socket, etc.)
May be this exception will help (after calling disconnect and then wait a little):
java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at com.jcraft.jsch.IO.getByte(IO.java:95)
at com.jcraft.jsch.Session.read(Session.java:1182)
at com.jcraft.jsch.Session.run(Session.java:1783)
at java.lang.Thread.run(Thread.java:748)
If I provide a logger accepting severity >= INFO via com.jcraft.jsch.JSch#setLogger it always reports the mentioned "Caught an exception, leaving main loop due to Socket closed" on disconnect" message after "Disconnecting from port ".
It looks confusing, because happens even in regular scenarios.
Would be great if you could resolved this, thanks!