JSch not closing sshd

2020-04-16 04:36发布

问题:

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)

回答1:

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.



标签: sftp jsch