Subject: Re: Incomplete read of channel 0 data from remote host.

Re: Incomplete read of channel 0 data from remote host.

From: Ted Lemon <mellon_at_fugue.com>
Date: Fri, 23 Jul 2010 10:51:19 -0400

On Jul 23, 2010, at 10:33 AM, Peter Stuge wrote:
> No, not really. Now would be a good time to enable debug output in
> your libssh2, and call libssh2_trace(session,~0); in your app. Then
> inspect/send the debug log.

Oh, interesting. I've included the tail end of the log below, with the hex dump excluded. It looks like all the data arrived, but not all of it came in when I did the read. My buffer for the read was 256 bytes; it looks like it discarded everything after that. When I made the buffer 25600 bytes instead of 256, I got all the output. This doesn't explain why I didn't get all the output from the initial read, but it's certainly interesting.

=> libssh2_transport_read() plain (10626 bytes)
[libssh2] 4.154395 Transport: Packet type 94 received, length=10626
[libssh2] 4.154418 Conn: 10617 bytes packet_add() for 0/0/0
[libssh2] 4.154457 Socket: Error recving 16384 bytes to 0x762120+0: 35
[libssh2] 4.154481 Conn: channel_read() got 154 of data from 0/0/0 [ul]
[libssh2] 4.154509 Conn: channel_read() got 22 of data from 0/0/0 [ul]
[libssh2] 4.154530 Conn: channel_read() got 9 of data from 0/0/0 [ul]
[libssh2] 4.154550 Conn: channel_read() got 1 of data from 0/0/0 [ul]
[libssh2] 4.154568 Conn: channel_read() got 1 of data from 0/0/0 [ul]
[libssh2] 4.154588 Conn: channel_read() got 1 of data from 0/0/0 [ul]
[libssh2] 4.154702 Conn: channel_read() got 1 of data from 0/0/0 [ul]
[libssh2] 4.154729 Conn: channel_read() got 1 of data from 0/0/0 [ul]
[libssh2] 4.154749 Conn: channel_read() got 2 of data from 0/0/0 [ul]
[libssh2] 4.154769 Conn: channel_read() got 16 of data from 0/0/0 [ul]
[libssh2] 4.154790 Conn: channel_read() got 48 of data from 0/0/0
len: 256 string: onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
e]0;mellon_at_toccata: ~atoccata% ls -l
total 12037508
drwxr-xr-x 2 mellon staff 4096 2002
current string:
[libssh2] 4.154956 Socket: Error recving 16384 bytes to 0x762120+0: 35
[libssh2] 4.155043 Conn: channel_read() wants 256 bytes from channel 0/0 stream #2
[libssh2] 4.155071 Socket: Error recving 16384 bytes to 0x762120+0: 35
sshStateConnected
need input...

At this point with the 256-byte buffer, it just hangs, even though we've received all the (voluminous) output from the ls.

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