On 02/23/2012 07:50 PM, Alexander Lamaison wrote:
> On 22 February 2012 22:55, Salvador Fandiņo<sfandino_at_yahoo.com> wrote:
>
>> I have been testing my module with libssh2 1.4.0 and found that put
>> transfers always stall after reading around 262130 +-10 from the channel
>> (note that my module does not use the SFTP functionality from libssh2, it
>> just connects to the remote server, creates a new channel and then writes
>> and reads from it).
>>
>> After seeing this thread I got the source from git, hoping that my problem
>> would have being also solved, but is hasn't.
> ...
>> I think it would be a good idea to test the patch with bigger transfers
>> before making a new release.
>
> You say you don't use libssh2's SFTP implementation so the changes
> introduced by the patch don't apply to your problem. They only change
> sftp.c.
yes, I know, I was hoping that the libssh2 sftp code were using the same
calls for accessing the channel data as Net::SSH2, but after inspecting
libssh2 code I can see that it is actually using a lower level API.
Net::SSH2 uses libssh2_channel_read_ex and, this may ring a bell, the
transfer stalls after exactly 256 * 1024 bytes have been read from the
channel.
What follows is the combined debug log from Net::SFTP and Net::SSH2, I
guess it is easy understandable. Lines beginning by // are my comments:
...
# reading at 0/4
Net::SSH2::Channel::read(size = 4, ext = 0)
- read 4 bytes
- read 4 total
# 4 bytes read from SSH channel, total 262108
# reading at 4/4
# reading at 4/28
Net::SSH2::Channel::read(size = 24, ext = 0)
- read 24 bytes
- read 24 total
# 24 bytes read from SSH channel, total 262132
# reading at 28/28
# 4125 bytes written to SSH channel, total 38558276
# reading at 0/4
Net::SSH2::Channel::read(size = 4, ext = 0)
- read 4 bytes
- read 4 total
# 4 bytes read from SSH channel, total 262136
# reading at 4/4
# reading at 4/28
// At this point, 262136 bytes have been read from the channel
// Net::SFTP::Foreign tries to read the remaining 24 bytes of the
// SSH2_FXP_STATUS response (the packet length, 4bytes, have
// already been read)
Net::SSH2::Channel::read(size = 24, ext = 0)
// Net::SSH2 calls libssh2_channel_read_ex(channel, XLATEXT, b, 24)
- read 8 bytes
// it reads 8 bytes and returns, at this point, 256*1024 bytes
// have been read from the channel.
// Net::SSH2 calls libssh2_channel_read_ex(channel, XLATEXT, b, 16)
// and it never returns, the debugger reveals the process is
// inside "poll".
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-02-23