Subject: RE: libssh2_sftp_write doesn't hang anymore

RE: libssh2_sftp_write doesn't hang anymore

From: Mark Riordan <mriordan_at_ipswitch.com>
Date: Fri, 12 Nov 2010 17:29:10 -0600

Daniel said:
> For this to be able to happen, I'm thinking there's something wrong with
the
> EAGAIN detection for win32 and I've just now remade how it is handled:
> previously we would convert from the win32 error to the errno value and
store
> that in errno to allow the parent function to read it.
>
> Starting now, we only use the _libssh2_recv and _libssh2_send functions
and
> they simply return the negative errno value on errors so that we don't
ever
> have to store anything in errno for win32 but only return the correct
value.
>
> Commit ca2e81eb1f1bcb3 was just pushed with this change.

I think we are getting somewhere.
The upload fails after the test program outputs this:
libssh2_sftp_write 1 sent 32000 bytes; 32000 so far
libssh2_sftp_write 2 sent 500 bytes; 32500 so far
libssh2_sftp_write 3 sent 32000 bytes; 64500 so far
libssh2_sftp_write 4 sent 500 bytes; 65000 so far

The trace log ends:

[libssh2] 0.724547 SFTP: Requiring packet 101 id 18
[libssh2] 0.724547 SFTP: Asking for 101 packet
[libssh2] 0.724547 SFTP: recv packet
[libssh2] 0.724547 Conn: channel_read() wants 4 bytes from channel 0/0
stream #0
[libssh2] 0.724547 Socket: Recved 68/16384 bytes to 0099016C+0
[libssh2] 0.724547 Transport: Packet type 94 received, length=37
[libssh2] 0.724547 Conn: 28 bytes packet_add() for 0/0/0
[libssh2] 0.724547 Conn: channel_read() got 4 of data from 0/0/0
[libssh2] 0.724547 SFTP: Data begin - Packet Length: 24
[libssh2] 0.724547 Conn: channel_read() got 24 of data from 0/0/0 [ul]
[libssh2] 0.724547 SFTP: Received packet 101 (len 24)
[libssh2] 0.724547 SFTP: Asking for 101 packet
[libssh2] 0.724547 SFTP: Got 101
[libssh2] 0.740171 Conn: Writing 4029 bytes on channel 0/0, stream #0
[libssh2] 0.740171 Conn: Sending 4029 bytes on channel 0/0, stream_id=0
[libssh2] 0.740171 Socket: Sent 4292/4292 bytes at 00994194
[libssh2] 0.740171 Conn: Writing 4029 bytes on channel 0/0, stream #0
[libssh2] 0.740171 Conn: Sending 4029 bytes on channel 0/0, stream_id=0
[libssh2] 0.740171 Socket: Sent 4292/4292 bytes at 00994194
[libssh2] 0.740171 Conn: Writing 4029 bytes on channel 0/0, stream #0
[libssh2] 0.740171 Conn: Sending 4029 bytes on channel 0/0, stream_id=0
[libssh2] 0.740171 Socket: Error sending 4292 bytes: 11

I put the full trace here:
http://trac.libssh2.org/attachment/ticket/197/2010-11-12b-error-11.zip
but I doubt you'll need it.

Thanks for all your hard work on this.

Mark

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-11-13