Re: [JSch-users] Unable to connect to SFTP server after 20 connects/disconnects
Status: Alpha
Brought to you by:
ymnk
From: René K. <rk...@gk...> - 2011-03-18 11:14:38
|
We have something similar in SSH connections with Jsch versions up to 0.1.44 to FreeSSHD (even latest versions). Accidentally the connection breaks with "SSH_MSG_DISCONNECT: Could not use server's key": Stacktrace: com.jcraft.jsch.JSchException: SSH_MSG_DISCONNECT: 9 Could not use server's key. Please contact server administrator to generate new key. at com.jcraft.jsch.Session.read(Session.java:899) at com.jcraft.jsch.Session.connect(Session.java:294) ... Sometimes it is possible to reconnect immediately and the connection is successful. This happens in an unpredictable way, on some test systems more, on some less, on some I've never heard about it, mostly using JRE 1.5.0_22 or 1.6.0_21. Just using some Jsch example application seems not to be sufficient to reproduce it. Our real-life scenario makes repeating connections and stresses the system quiet a lot. This might be similar to your issue. René On Friday 18 March 2011 11:32:20 Gustav Karlsson wrote: > Hi, > > We are experiencing an issue when using Jsch to connect to a SFTP-server. > It seems like the sessions are not properly closed or cleared, resulting > in a rejection from the SFTP server after 20 connects+disconnects. > > 1. Execute commands connect, cd, ls and disconnect on SFTP-server 20 > times. (We disconnect both the channel and the session) 2. The next > connect results in an exception. (connection through command-line sftp now > returns an error "ssh_exchange_identification: Connection closed by remote > host") 3. Wait ~30 min and connects will again be accepted. > > Has anyone experienced a similar issue and/or know the cause? Connecting > 20+ times using the command-line SFTP-client does not result in this > problem. > > Regards, > Gustav Karlsson |