Subject: Re: proper buffer size for libssh2_sftp_read()

Re: proper buffer size for libssh2_sftp_read()

From: zl liu <xieepp_at_gmail.com>
Date: Wed, 15 Jun 2011 17:14:36 +0800

2011/6/15 Daniel Stenberg <daniel_at_haxx.se>

> On Wed, 15 Jun 2011, zl liu wrote:
>
> I get a problem when i download a file about 20M bytes via non-blocking
>> mode.
>>
>
> We need more details. I've successfully transfered much larger downloads
> than 20M over SFTP - many times.
>
> Is this with 1.2.8? On what operating system? What server software is on
> the other end?

 yes,1.2.8. the test is running on windows 7 .
the other end is Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
sshd version is OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003

>
>
> if the mem size if 1024 or 1024 * 10. it will success.
>>
>
> But the downside will of course be that transfers will never be very fast
> with such a small buffer...
>
>
> [libssh2] 6.535906 Failure Event: -7 - Unable to send transfer-window
>> adjustment packet, deferring
>>
>
> Interesting. -7 is LIBSSH2_ERROR_SOCKET_SEND returned from
> _libssh2_transport_send, which afaics only can occur if send() really
> returns an error that isn't EAGAIN. Is the problem repeatable? Can you add
> some logging of exactly what is stored in errno when the
> LIBSSH2_ERROR_SOCKET_SEND is returned?
>
> yes the problem repeat too many times.
after i modify the misc.c::445 like : fprintf(stderr, "%s, %d\n", buffer,
GetLastError());
when -7, the system errno is 10035.
when -24 the system errno is 0.
when -25 the system errno is 10035.

the followingis is parts of the message£º
[libssh2] 14.483347 Failure Event: -24 - Remote sent more data than current
wind
ow allows, truncating, 0
[libssh2] 14.488347 Failure Event: -25 - SFTP packet too large, 10035
[libssh2] 14.488347 Failure Event: -25 - Error waiting for FXP_READ ACK,
10035

Is that -7 line the first error you can spot in the trace output?
>
> yes

> [libssh2] 6.515906 Failure Event: -24 - Remote sent more data than current
>> window allows, truncating
>>
>
> That seems like a side-effect from the previous failure. When this happens
> I think it all goes downhill and badness is all over.
>
> yes, even i reconnect ,it doesn't work.

> another question , why not define the MACRO :LIBSSH2DEBUG in the debug
>> mode. when i want to enable trace£¬i must define the macro LIBSSH2DEBUG
>> manually and compile it again.
>>
>
> That's what we have "./configure --enable-debug" for!
>
> i compile on win32 .it can not execute ./configure.

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

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-06-15