hierynomus / sshj

ssh, scp and sftp for java
Apache License 2.0
2.49k stars 600 forks source link

SSHJ disconnect exception #885

Open dpengftw opened 1 year ago

dpengftw commented 1 year ago

[reader] INFO net.schmizz.sshj.transport.TransportImpl - Received SSH_MSG_DISCONNECT (reason=BY_APPLICATION, msg=User Disconnected) [reader] ERROR net.schmizz.sshj.transport.TransportImpl - Dying because - User Disconnected net.schmizz.sshj.transport.TransportException: [BY_APPLICATION] User Disconnected at net.schmizz.sshj.transport.TransportImpl.gotDisconnect(TransportImpl.java:565) at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:521) at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:113) at net.schmizz.sshj.transport.Decoder.received(Decoder.java:203) at net.schmizz.sshj.transport.Reader.run(Reader.java:60) [reader] INFO net.schmizz.sshj.transport.TransportImpl - Disconnected - BY_APPLICATION [main] ERROR net.schmizz.concurrent.Promise - <<chan#0 / close>> woke to: net.schmizz.sshj.connection.ConnectionException: User Disconnected Caused by: net.schmizz.sshj.connection.ConnectionException: User Disconnected at net.schmizz.sshj.connection.ConnectionException$1.chain(ConnectionException.java:32) at net.schmizz.sshj.connection.ConnectionException$1.chain(ConnectionException.java:26) at net.schmizz.concurrent.Promise.deliverError(Promise.java:95) at net.schmizz.concurrent.Event.deliverError(Event.java:74) at net.schmizz.concurrent.ErrorDeliveryUtil.alertEvents(ErrorDeliveryUtil.java:34) at net.schmizz.sshj.connection.channel.AbstractChannel.notifyError(AbstractChannel.java:239) at net.schmizz.sshj.connection.channel.direct.SessionChannel.notifyError(SessionChannel.java:229) at net.schmizz.sshj.common.ErrorNotifiable$Util.alertAll(ErrorNotifiable.java:35) at net.schmizz.sshj.connection.ConnectionImpl.notifyError(ConnectionImpl.java:261) at net.schmizz.sshj.transport.TransportImpl.die(TransportImpl.java:620) at net.schmizz.sshj.transport.Reader.run(Reader.java:66) Caused by: net.schmizz.sshj.transport.TransportException: [BY_APPLICATION] User Disconnected at net.schmizz.sshj.transport.TransportImpl.gotDisconnect(TransportImpl.java:565) at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:521) at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:113) at net.schmizz.sshj.transport.Decoder.received(Decoder.java:203) at net.schmizz.sshj.transport.Reader.run(Reader.java:60)

MFT-14336/IT43709 - sshj SFTP client's sessions not getting clean disconnect after SSP upgrade When the client is closing the sftp channel, SSP was closing everything on its side . It was disconnecting the ssh connection before closing the channel. Resolution: Changed the order on SSP side to close the sftp channel and then disconnect the ssh connection. Still this jssh sample client is throwing stacktrace. Created a system property "sftp.channel.disconnect", when set to false, will bypass this disconnect (the default value is true). With this change the sshj client is terminates the connection correctly.

akhileshagarwal85 commented 3 months ago

I am also seeing the same issue after our partner changed the remote SFTP server. Any clue how it can be fixed?

dpengftw commented 3 months ago

We asked our partner to apply a patch to their newly migrated SFTP server and that resolved the issue, but still disconcerting that the regular unix "sftp" command would work, but not sshj. 😟

akhileshagarwal85 commented 3 months ago

What patch?

dpengftw commented 3 months ago

The partner's SFTP server side applied a patch, not on our end.

akhileshagarwal85 commented 3 months ago

Yes, that I understand but you said that you asked your partner to apply a patch and I thought you knew which/what patch they applied on their SFTP which fixed the issue.

dpengftw commented 3 months ago

I do but due to confidentiality, those details are muted here.