"Daniel Stenberg" <dan...@haxx.se> wrote in message 
news:alpine.deb.1.10.0902040905110.27...@yvahk2.pbagnpgbe.fr...
> On Tue, 3 Feb 2009, Markus Moeller wrote:
>
>>> [libssh2] Connection: Sending 39 bytes on channel 0/0, stream_id=0
>>> [libssh2] Connection: libssh2_packet_write returned EAGAIN
>>> 100  112k    0     0    0  112k      0  95334 --:--:--  0:00:01 --:--:-- 
>>> 219k[l
>>> ibssh2] Connection: Sending 16345 bytes on channel 0/0, stream_id=0
>>> [libssh2] Connection: Writing -16345 bytes on channel 0/0, stream #0
>>> 100  143k    0     0    0  143k      0   116k --:--:--  0:00:01 --:--:-- 
>>> 116k[l
>>> ibssh2] Connection: Freeing channel 0/0 resources
>>> [libssh2] Connection: Closing channel 0/0
>>> [libssh2] Connection: Window adjust received for channel 0/0, adding 
>>> 81881
>>> bytes, new window_size=131072
>>> [libssh2] Connection: Close received for channel 0/0
>>>
>>> curl: (55) Failed sending data to the peer
>>
>> Interestingly when I compile cutl with /DCURLDEBUG=1 it works.
>
> Ugh. Based on that initial output I would've guessed at a libssh2 flaw, 
> but if
> additional debug output in libcurl changes the behavior it sounds more 
> like
> timing is also involved and then the bug could possibly still be in 
> libcurl...
> :-/
>
> Unfortunately I think the only thing to do here is to do full debugging. I
> haven't seen this problem myself so I'm not the right person to do the 
> work
> here.
>


I added my own debug statements (see attachments). And it looks to me that
for some unkown reason the client can not sent the 16384
 bytes (only 16360) and when the client tries to send the last 24 with
libssh2_packet_write return with EAGAIN.
Should the client recover from this ?
If yes then I don't understand what happens. It looks just wrong. Can
someone explain what should happen ?

Thank you
Markus

D:\BuildArea\curl-7.19.3>src\curl.exe -T src\curl.exe -u markus
scp://server/tmp/dummy.exe
Enter host password for user 'markus':
channel_write_ex start | write_bufwrote 0 buflen 24
channel_write_ex after idle | write_bufwrote 0 buflen 24
channel_write_ex new buflen 0
channel_write_ex new write_bufwrote 24
channel_write_ex return write_bufwrote 24
Curl_scp_send len: 16384
channel_write_ex start | write_bufwrote 24 buflen 16384
channel_write_ex after idle | write_bufwrote 0 buflen 16384
channel_write_ex new buflen 0
channel_write_ex new write_bufwrote 16384
channel_write_ex return write_bufwrote 16384
Curl_scp_send nwrite: 16384
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
Current
                                 Dload  Upload   Total   Spent    Left
Speed
100 16384    0     0    0 16384      0  20177 --:--:-- --:--:-- --:--:-- 
20177
Curl_scp_send len: 16384
channel_write_ex start | write_bufwrote 16384 buflen 16384
channel_write_ex after idle | write_bufwrote 0 buflen 16384
channel_write_ex new buflen 0
channel_write_ex new write_bufwrote 16384
channel_write_ex return write_bufwrote 16384
Curl_scp_send nwrite: 16384
Curl_scp_send len: 16384
channel_write_ex start | write_bufwrote 16384 buflen 16384
channel_write_ex after idle | write_bufwrote 0 buflen 16384
channel_write_ex new buflen 0
channel_write_ex new write_bufwrote 16384
channel_write_ex return write_bufwrote 16384
Curl_scp_send nwrite: 16384
Curl_scp_send len: 16384
channel_write_ex start | write_bufwrote 16384 buflen 16384
channel_write_ex after idle | write_bufwrote 0 buflen 16384
channel_write_ex new buflen 0
channel_write_ex new write_bufwrote 16384
channel_write_ex return write_bufwrote 16384
Curl_scp_send nwrite: 16384
Curl_scp_send len: 16384
channel_write_ex start | write_bufwrote 16384 buflen 16384
channel_write_ex after idle | write_bufwrote 0 buflen 16384
channel_write_ex new buflen 0
channel_write_ex new write_bufwrote 16384
channel_write_ex return write_bufwrote 16384
Curl_scp_send nwrite: 16384
Curl_scp_send len: 16384
channel_write_ex start | write_bufwrote 16384 buflen 16384
channel_write_ex after idle | write_bufwrote 0 buflen 16384
channel_write_ex new buflen 0
channel_write_ex new write_bufwrote 16384
channel_write_ex return write_bufwrote 16384
Curl_scp_send nwrite: 16384
Curl_scp_send len: 16384
channel_write_ex start | write_bufwrote 16384 buflen 16384
channel_write_ex after idle | write_bufwrote 0 buflen 16384
channel_write_ex new buflen 0
channel_write_ex new write_bufwrote 16384
channel_write_ex return write_bufwrote 16384
Curl_scp_send nwrite: 16384


Curl_scp_send len: 16384
channel_write_ex start | write_bufwrote 16384 buflen 16384
channel_write_ex after idle | write_bufwrote 0 buflen 16384
channel_write_ex new window size | write_bufwrite 16384 window_size 16360
channel_write_ex new buflen 24
channel_write_ex new write_bufwrote 16360
channel_write_ex after idle | write_bufwrote 16360 buflen 24
channel_write_ex packet EAGAIN
Curl_scp_send nwrite: -37

100  112k    0     0    0  112k      0   119k --:--:-- --:--:-- --:--:-- 
768k

Curl_scp_send len: 16384
channel_write_ex start | write_bufwrote 16360 buflen 16384
channel_write_ex after idle | write_bufwrote 16360 buflen 16384
channel_write_ex new buflen 16360
channel_write_ex new write_bufwrote 16384
channel_write_ex after idle | write_bufwrote 16384 buflen 16360
channel_write_ex new buflen 0
channel_write_ex new write_bufwrote 32744
channel_write_ex return write_bufwrote 32744
Curl_scp_send nwrite: 32744
Curl_scp_send len: -16360
channel_write_ex start | write_bufwrote 32744 buflen -16360
Curl_scp_send nwrite: -1
100  143k    0     0    0  143k      0   148k --:--:-- --:--:-- --:--:-- 
148k
curl: (55) Failed sending data to the peer





curl-7.19.3

--- lib/ssh.c   2008-12-29 21:13:15.000000000 +0000
+++ /tmp/ssh.c  2009-02-05 20:29:08.000000000 +0000
@@ -2452,9 +2452,10 @@
   (void)sockindex; /* we only support SCP on the fixed known primary socket 
*/

   /* libssh2_channel_write() returns int! */
+  fprintf(stdout,"Curl_scp_send len: %d\n",len);
   nwrite = (ssize_t)
     libssh2_channel_write(conn->proto.sshc.ssh_channel, mem, len);
-
+  fprintf(stdout,"Curl_scp_send nwrite: %d\n",nwrite);
   ssh_block2waitfor(conn, (nwrite == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE);

   if(nwrite == LIBSSH2_ERROR_EAGAIN)


libssh2-1.0

--- src/channel.c       2008-12-22 22:09:11.000000000 +0000
+++ /tmp/channel.c      2009-02-05 20:29:08.000000000 +0000
@@ -1736,6 +1736,7 @@
     LIBSSH2_SESSION *session = channel->session;
     libssh2pack_t rc;

+ fprintf(stdout,"channel_write_ex start | write_bufwrote %d buflen %d 
\n",channel->write_bufwrote,buflen);
     if (channel->write_state == libssh2_NB_state_idle) {
         channel->write_bufwrote = 0;

@@ -1772,6 +1773,7 @@
     }

     while (buflen > 0) {
+ fprintf(stdout,"channel_write_ex after idle | write_bufwrote %d buflen %d 
\n",channel->write_bufwrote,buflen);
         if (channel->write_state == libssh2_NB_state_allocated) {
             channel->write_bufwrite = buflen;
             channel->write_s = channel->write_packet;
@@ -1818,6 +1820,7 @@
                                "window_size on %lu/%lu/%d",
                                channel->local.window_size, 
channel->local.id,
                                channel->remote.id, stream_id);
+                 fprintf(stdout,"channel_write_ex new window size | 
write_bufwrite %d window_size %d 
\n",channel->write_bufwrite,channel->local.window_size);
                 channel->write_bufwrite = channel->local.window_size;
             }
             if (channel->write_bufwrite > channel->local.packet_size) {
@@ -1826,6 +1829,7 @@
                                "packet_size on %lu/%lu/%d",
                                channel->local.packet_size, 
channel->local.id,
                                channel->remote.id, stream_id);
+ 
fprintf(stdout,"channel_write_ex new packet size | write_bufwrite %d 
window_size %d \n",channel->write_bufwrite,channel->local.packet_size);
                 channel->write_bufwrite = channel->local.packet_size;
             }
             libssh2_htonu32(channel->write_s, channel->write_bufwrite);
@@ -1846,6 +1850,7 @@
                                       channel->write_s -
                                       channel->write_packet);
             if (rc == PACKET_EAGAIN) {
+                               fprintf(stdout,"channel_write_ex packet 
EAGAIN\n");
                 _libssh2_debug(session, LIBSSH2_DBG_CONN,
                                "libssh2_packet_write returned EAGAIN");
                 return PACKET_EAGAIN;
@@ -1863,8 +1868,11 @@

             /* Adjust buf for next iteration */
             buflen -= channel->write_bufwrite;
+fprintf(stdout,"channel_write_ex new buflen %d\n",buflen);
+
             buf += channel->write_bufwrite;
             channel->write_bufwrote += channel->write_bufwrite;
+fprintf(stdout,"channel_write_ex new write_bufwrote 
%d\n",channel->write_bufwrote);

             channel->write_state = libssh2_NB_state_allocated;

@@ -1881,7 +1889,7 @@
     channel->write_packet = NULL;

     channel->write_state = libssh2_NB_state_idle;
-
+ fprintf(stdout,"channel_write_ex return write_bufwrote 
%d\n",channel->write_bufwrote);
     return channel->write_bufwrote;
 }






> -- 
>
>  / daniel.haxx.se
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with 
> Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code 
> to
> build responsive, highly engaging applications that combine the power of 
> local
> resources and data with the reach of the web. Download the Adobe AIR SDK 
> and
> Ajax docs to start building applications 
> today-http://p.sf.net/sfu/adobe-com 



------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to