cURL / Mailing Lists / curl-library / Single Mail


Re: FW: scp upload failure memory leak

From: Jeff Weber <>
Date: Tue, 27 May 2008 15:47:28 -0500

On Mon, May 26, 2008 at 11:39:26PM +0200, Daniel Stenberg wrote:
> On Mon, 26 May 2008, Daniel Stenberg wrote:
>> Argh, it killed test case 612. I'll have to do some more work and get
>> back.
> Okay, it was test 621 it broke (me and my lousy typing!), but here's my
> updated attempt and this one doesn't break anything for me and yet it fixes
> the two memory leak cases. See the attachement. I'll commit this within a
> day or two unless someone finds problems with it.

The new scp, sftp upload timeout test cases also pass without leaks
with the new scp-sftp-leaks-2.patch . However, I am having different
results with my application code. The code opens a connection to a
remote ssh server, then uploads N files using the same curl easy
handle, hopefully re-using the same connection.

sftp upload works great. The sftp upload timeout memory leak is now
gone. (I have had no problems with CURLOPT_TIMEOUT for sftp upload

However, when I break the network connection during a series of scp uploads
that share the same connection, the CURLOPT_TIMEOUT doesn't work, and I get
memory leaks. In all cases, I successfully set CURLOPT_TIMEOUT to 30sec before
starting the uploads and breaking the connection. However, when I break the
connection during the SSH_SCP_UPLOAD_INIT state, the upload hangs for about
15min. curl does not emit the debug message

    Operation timed out after 30000 milliseconds ...

that it emitted for the same upload using sftp. The CURLOPT_TIMEOUT
doesn't seem to work well for the scp upload timeout. I've attached
debug and valgrind output for 2 tests.


“This e-mail message and any attachments are confidential and may be privileged.
If you are not the intended recipient please notify American Superconductor Corporation
immediately by replying to this message or by sending a message to
and destroy all copies of this message and any attachments.
Thank you.”

Received on 2008-05-27