Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Lindani Phiri <lphiri@nc...> - 2004-02-27 15:54:29
|
I found that sending (put) any files larger than 1K were hanging the jsch client. The problem in my case was that my server had stringent window size requirements (max 1K). The client was then hanging in the write method of Session.java: public /*synchronized*/ void write(Packet packet, Channel c, int length) throws Exception{ while(true){ if(c.rwsize>length){ c.rwsize-=length; break; } try{ Thread.sleep(10); }catch(Exception e){}; } write(packet); } In my case c.rwsize>length will never be true for files larger than 1K (put method attempts to read in 1024 bytes at a time) , so I got stuck in the while loop. My fix for this was to check for the available remote window size (rwsize) in the put method of ChannelSftp and make sure that I only attempt to send a length smaller then the available window space (minus any packet padding such as handle.length) . This also improved my performance as I can send much more than the hardcoded 1024 bytes at a time, if the window space is available. Also I changed the above code to : public /*synchronized*/ void write(Packet packet, Channel c, int length) throws Exception{ int retry = 0; while(true){ if(c.rwsize>length){ c.rwsize-=length; break; } Thread.sleep(10); retry++; if (retry > 10000) throw Exception("Unable to negotiate adequate window size"); //wait for only 100s } write(packet); } So the caller can at least get an exception if the required window size is not obtained in after a certain wait. LD. |
From: <ymnk@jc...> - 2004-03-01 09:12:24
|
Hi, Thank you for feedback. +-From: Lindani Phiri <lphiri@...> -- |_Date: Fri, 27 Feb 2004 10:47:26 -0500 ___ | |I found that sending (put) any files larger than 1K were hanging |the jsch client. The problem in my case was that my server had |stringent window size requirements (max 1K). The client was then |hanging in the write method of Session.java: Do you mean that .... $ ssh -v -v localhost Connecting to localhost... OpenSSH_3.4p1, SSH protocols 1.5/2.0, OpenSSL 0x0090701f debug1: Reading configuration data /home/yamanaka/.ssh/config ... snip ... debug1: Sending subsystem: sftp debug1: channel request 0: subsystem debug2: callback done debug1: channel 0: open confirm rwindow 0 rmax 32768 debug2: channel 0: rcvd adjust 131072 <---------------- debug2: Remote version: 3 sftp> 131072 has been 1024 on your environment? Anyway, I have understood what is the problem and I will post the revised version to fix this problem within a few days. # I'm sorry, but I'm a little bit busy now. Thanks, -- ymnk |
From: <ymnk@jc...> - 2004-03-02 10:19:10
|
Hi, +-From: Lindani Phiri <lphiri@...> -- |_Date: Fri, 27 Feb 2004 10:47:26 -0500 ___ | |I found that sending (put) any files larger than 1K were hanging |the jsch client. The problem in my case was that my server had |stringent window size requirements (max 1K). I could reproduce your problem by reducing the window size of sshd. But, I had to re-compile it from the source code. I'm very interested in your sshd. Why your sshd has such a small window size? Do you know the reason? Anyway, please try http://www.jcraft.com/jsch/jsch-0.1.14-rc1.zip It is just a quick hack, but I have confirmed that it will work for such a sshd. Thanks, -- ymnk |
From: Filip Hanik \(lists\) <devlists@ha...> - 2004-03-02 17:05:17
|
this is the same place the scp with Ant was hanging. Filip -----Original Message----- From: jsch-users-admin@... [mailto:jsch-users-admin@...]On Behalf Of Lindani Phiri Sent: Friday, February 27, 2004 7:47 AM To: jsch-users@... Subject: [JSch-users] Sftp Hangs for large files - the fix I found that sending (put) any files larger than 1K were hanging the jsch client. The problem in my case was that my server had stringent window size requirements (max 1K). The client was then hanging in the write method of Session.java: public /*synchronized*/ void write(Packet packet, Channel c, int length) throws Exception{ while(true){ if(c.rwsize>length){ c.rwsize-=length; break; } try{ Thread.sleep(10); }catch(Exception e){}; } write(packet); } In my case c.rwsize>length will never be true for files larger than 1K (put method attempts to read in 1024 bytes at a time) , so I got stuck in the while loop. My fix for this was to check for the available remote window size (rwsize) in the put method of ChannelSftp and make sure that I only attempt to send a length smaller then the available window space (minus any packet padding such as handle.length) . This also improved my performance as I can send much more than the hardcoded 1024 bytes at a time, if the window space is available. Also I changed the above code to : public /*synchronized*/ void write(Packet packet, Channel c, int length) throws Exception{ int retry = 0; while(true){ if(c.rwsize>length){ c.rwsize-=length; break; } Thread.sleep(10); retry++; if (retry > 10000) throw Exception("Unable to negotiate adequate window size"); //wait for only 100s } write(packet); } So the caller can at least get an exception if the required window size is not obtained in after a certain wait. LD. ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ JSch-users mailing list JSch-users@... https://lists.sourceforge.net/lists/listinfo/jsch-users --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.594 / Virus Database: 377 - Release Date: 2/24/2004 |
From: <ymnk@jc...> - 2004-03-03 14:18:13
|
Hi, +-From: "Filip Hanik (lists)" <devlists@...> -- |_Date: Tue, 2 Mar 2004 08:52:26 -0800 __ | |this is the same place the scp with Ant was hanging. May I ask you to try http://www.jcraft.com/jsch/jsch-0.1.14-rc1.zip Thanks, -- ymnk |