www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: select timeouts after libssh2_sftp_open_ex

select timeouts after libssh2_sftp_open_ex

From: Anton Obukhov <anton_at_ubnt.com>
Date: Fri, 12 Oct 2012 20:53:35 -0700

Hello,

I'm trying to implement SFTP streaming functionality, and came across this
issue. In the code attached, a random data is generated, and its portions
are uploaded to a remote machine to /tmp/test using SFTP. Then, this file
is repeatedly downloaded back to the host.

The code uses non-blocking API. For file sizes between 1000 and 20000 bytes
it works great. However, when data size is 30000 bytes, the upload happens
successfully, but the following download results in a timeout in select
after the call to libssh2_sftp_open_ex returns LIBSSH2_ERROR_EAGAIN.

Here is the relevant piece of trace (full trace is attached to this email
along with main.cpp, which can be compiled easily). I tried to strip the
code as much as possible to make it self-contained, but please let me know
if any additional information is required. Thanks in advance!

5ff0: 6D 59 0F 67 AD CD 1C 23 A8 7E 19 F4 19 30 51 A6 : mY.g...#.~...0Q.
6000: 3C 10 BC B7 : <...
>>>>> End libssh2_sftp_write res=0
>>>>> Begin libssh2_sftp_open_ex
[libssh2] 0.800717 SFTP: Sending file open request
[libssh2] 0.800717 Conn: Writing 34 bytes on channel 0/0, stream #0
[libssh2] 0.802717 Conn: Writing 34 bytes on channel 0/0, stream #0
[libssh2] 0.802717 Socket: Recved 52/16384 bytes to 02e38fd4+0
=> libssh2_transport_read() raw (52 bytes)
0000: 69 F3 B6 5E 2E 43 6F 2B 1E FC EA 36 E9 40 6D A3 : i..^.Co+...6._at_m.
0010: 80 7F E3 69 90 E1 A0 60 9A 01 ED 2E 67 8D D3 97 : ...i...`....g...
0020: DD 08 AB 06 1C 24 E7 E0 2F 8B 57 B4 09 15 22 AB : .....$../.W...".
0030: 7D 8E A9 E2 : }...
=> libssh2_transport_read() plain (9 bytes)
0000: 5D 00 00 00 00 00 00 60 00 : ]......`.
[libssh2] 0.802717 Transport: Packet type 93 received, length=9
[libssh2] 0.802717 Conn: Window adjust for channel 0/0, adding 24576 bytes,
new window_size=24576
[libssh2] 0.802717 Conn: Sending 34 bytes on channel 0/0, stream_id=0
=> libssh2_transport_write plain (9 bytes)
0000: 5E 00 00 00 00 00 00 00 22 : ^......."
=> libssh2_transport_write plain2 (34 bytes)
0000: 00 00 00 1E 03 00 00 00 02 00 00 00 09 2F 74 6D : ............./tm
0010: 70 2F 74 65 73 74 00 00 00 01 00 00 00 04 00 00 : p/test..........
0020: 81 B6 : ..
[libssh2] 0.802717 Socket: Sent 84/84 bytes at 02e3cffc
=> libssh2_transport_write send() (84 bytes)
0000: 46 99 5C 82 A2 14 F9 68 9E EC C3 A3 C8 5A 8C A6 : F.\....h.....Z..
0010: 6B 98 86 79 99 74 00 CA 30 65 CC 1B 76 1C D2 5A : k..y.t..0e..v..Z
0020: DE A1 0F AC EE 8E D7 9A EA A5 75 D6 E5 81 3A 74 : ..........u...:t
0030: C2 1A 98 55 91 92 F2 68 A0 58 60 49 C6 09 1F 96 : ...U...h.X`I....
0040: B6 2F 2E 56 95 D2 A8 6E 85 26 E5 10 DF FD D1 EC : ./.V...n.&......
0050: DF 06 E7 3C : ...<
[libssh2] 0.802717 SFTP: recv packet
### Error: select timeout
file=main.cpp
line=241
>>>>> Begin libssh2_sftp_close_handle
[libssh2] 5.809003 SFTP: Closing handle

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Received on 2012-10-13

the libssh2 team