Has anyone seen where JSch leaves sshd sessions open?
I've got a java client which performs regular SFTP connections (it polls every one hour) and it seems to leave behind a sshd session. These eventually build up over time and causes us to have a "too many files open" exception in the OS (it hits the limit per process(1024) for those who are interested).
In my client I close the SFTPChannel, then the Channel (redundant really as closing the SFTPChannel closes the Channel) and lastly the Session, so I'm pretty sure I'm cleaning up correctly (and I can see I have a 'disconnect' for each 'connect', so they do marry up)
Please refer to a mail thread of jsch-users ML,
That problem has been caused by a bug in older OpenSSH's sshd. The recent OpenSSH has fixed it.
来源:https://stackoverflow.com/questions/7398634/jsch-not-closing-sshd