Subject: RE: SFTP issues

RE: SFTP issues

From: Mark Smith <>
Date: Sat, 4 Feb 2012 13:09:31 -0000

I've encountered a similar problem on a 64bit Win2008 server whereby the
buffer size makes a difference as to whether a read returns zero incorrectly
or not.

I'll try to put together a native example on Monday as all I have right now
is my wrapped .NET example: read from an empty file with a buffer of 27000,
which returns zero correctly, then on the same SFTP connection read from a
57 byte file with the same buffer and I always get zero back. It doesn't
seem to matter if there's no delay between the two reads or if I allow a
minute to pass, it still behaves the same.

If I change the buffer size to 26999 and I get 57 back correctly. If I run
this exact same test on a 32bit WinXP machine it always returns correctly
irrespective of buffer size. I've tried testing against different SFTP
servers and machines (specifically freeSSHd on the local Win2k8 machine,
freeSSHd on the WinXP machine and debian's openssh) and the test behaves the
same against all of them.

This is completely reproducible for me and occurs every single time I try.
Let me know if you'd like me to try out any patches or need trace or debug
information and I'll see what I can do.

-----Original Message-----
[] On Behalf Of Daniel Stenberg
Sent: 04 February 2012 12:28
To: libssh2 development
Subject: Re: SFTP issues

On Thu, 2 Feb 2012, Alexander Lamaison wrote:

> Daniel, liuzl: we went through this process in September and you guys made

> some fixes which I though had solved it. I've changed both the Windows
> Linux machines I'm testing on since then so I don't know if that's why the

> problems are back. I don't understand enough about the SFTP layer to
> suggest a fix but, as usual, I'll happily test any patches.

I too was under the impression we improved things, and I know a lot of
have used libssh2 fine since then too so the problems you see might not
trigger that often in the real world.

I haven't yet investigated what you report here, but I'll try to set aside
some time to dig into the details again soon and see if I can produce some
patches to try out.

Received on 2012-02-04