Subject: Re: Using libssh2 1.4.3 is creating corrupt files.

Re: Using libssh2 1.4.3 is creating corrupt files.

From: Daniel Stenberg <>
Date: Mon, 21 Oct 2013 15:47:29 +0200 (CEST)

On Mon, 21 Oct 2013, wrote:

> Buffer size change (we have no idea what the 33 was for, but it was
> probably required in the old version)
> -#define WRITEBUFFERSIZE (1024*32)-33
> +#define WRITEBUFFERSIZE 1024*128

Ah, you're talking about the buffer size you pass in to a libssh2 function.
libssh2_sftp_write() I take it.

> Behavior wasn't reproducible when I moved the code, it instead 'hung' at a
> different part of the file transfer (in terms of bytes). Haven't tried
> putting it in a separate application yet. As it won't reproducible
> independently, we haven't been able to test if there is some magic file size
> that causes the problem.

But if the problem can't be repeated independently, how can you then be sure
it is due to the buffer size change? If it truly is a problem with a 32K
buffer, then surely it won't work if you write a small stand-alone program
using a 32K upload buffer? Could it be that the -33 is causing the problem?

> We're using Windows, server is Tectia on Windows. The application was
> compiled on a 32 bit Windows XP machine using Builder XE.
> We also switched from openssl to libgcrypt when we migrated from 1.2.7 to
> 1.4.3

And you decided that could not be a reason for the new problem?

> This happens across multiple client/server environments with differing
> amounts of RTT, but here it is essentially negligible.

That's good information as SFTP is fairly sensitive to RTT and could
potentially show different behaviors.

Received on 2013-10-21