#206: Calling libssh2_sftp_read multiple times with a reducing buffer size sends
a large amount of outbound packets
---------------------------------------------------------------------------------------+
  Reporter:  
www.google.com/accounts/o8/id?id=aitoawklaurjnhtim8cmypfnamil7ugv00-86qe  |     
  Owner:     
      Type:  defect                                                             
       |      Status:  new
  Priority:  normal                                                             
       |   Milestone:     
 Component:  SFTP                                                               
       |     Version:     
  Keywords:                                                                     
       |      Blocks:     
Blocked By:                                                                     
       |  
---------------------------------------------------------------------------------------+
 When I call libssh2_sftp_read multiple times with a reducing buffer size,
 the 2nd call takes a long time/hangs and begins sending a large amount of
 data to the server. At this point it fills the network socket's send
 buffer and then call to libssh2_sftp_read finishes. When calling
 libssh2_sftp_close on the file handle, the return code is -7
 (LIBSSH2_ERROR_SOCKET_SEND).

 This only happens when subsequent calls to libssh2_sftp_read have a
 smaller buffer size than the previous call. If the buffer size is the same
 or larger there are no problems. A real world example of this is:
 1. Open a remote file with a size of 8000 bytes with libssh2_sftp_open
 2. First call to libssh2_sftp_read with a buffer size of 8000 returns just
 the first 2000 bytes
 3. Second call to libssh2_sftp_read with a buffer size of 6000 (8000-2000)
 returns 6000 bytes
 4. Inspect rate of outbound network traffic and return value of
 libssh2_sftp_close

 Client Environment:
 Source: daily snapshot libssh2-1.2.8-20110113
 Compiler: VC2010 (x86) on Windows 7 64-bit

 Server Environment:
 Ubuntu 10.10 64-bit with openssh-server
 Reproducable on:
 1. a remote Xen VPS host with 180ms ping
 2. VMWare virtualised local host running with < 1 ms ping

 Attachments:
 Modified example\sftp.c

-- 
Ticket URL: <http://trac.libssh2.org/ticket/206>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to