Re: [JSch-users] JSch: Too many open files
Status: Alpha
Brought to you by:
ymnk
|
From: <ym...@jc...> - 2012-04-17 07:30:03
|
Hi,
+-From: Maximilien Renard <iix...@gm...> --
|_Date: Mon, 16 Apr 2012 18:20:33 +0200 __________
|
|Saddly, as I started stress-testing the application, I've noticed
|that after a certain number of file SFTP transfer, the library
|"crashes" with the following message:
|1: Caught an exception, leaving main loop due to SSH_MSG_DISCONNECT: 2
|Could not create socket pairs: Too many open files
|1: Disconnecting from 195.244.167.187 port 10004
It seems "socket pairs" means the Unix domain sockets for the communication
between "sshd" and "/usr/libexec/openssh/sftp-server", and it has been failed
to create them due to "Too many open files", as the message says.
At least, I guess that you can work around that error if the channel is
re-used without invoking "closeAndDisconnectSftpChannel()".
As for the problem, I have confirmed that the following chunk of code
will cause the reported error for sftp-server of OpenSSH 4.3p2,
for(int i = 0; i< 1024; i++){
try{
ChannelSftp c = (ChannelSftp)session.openChannel("sftp");
c.connect();
c.disconnect();
}
catch(Exception e){
System.out.println("i: "+i+" "+e);
break;
}
}
However, I could not reproduce it for sftp-server of OpenSSH 5.3p1.
Which OpenSSH version are you using? Frankly to say, I have not found
the problem in JSch yet, and have suspected that the older OpenSSH versions
may have the resource leaks in managing Unix sockets.
Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
Skype callto://jcraft/
Twitter: http://twitter.com/ymnk
Facebook: http://facebook.com/aymnk
|