Subject: Re: Debugging SCP failure: "Timed out waiting for SCP response"

Re: Debugging SCP failure: "Timed out waiting for SCP response"

From: Daniel Stenberg <>
Date: Mon, 11 Oct 2010 15:32:09 +0200 (CEST)

On Mon, 11 Oct 2010, Tim Martin wrote:

>> Try changing the error codition to (rc < 0 and add a
>> else if(rc == 0)
>> continue;

> If I do that, I get what looks like an infinite loop (I gave up after 60
> seconds).

Hm, it shouldn't get into an infinite loop. _libssh2_channel_read() should
return EAGAIN if called again without there being any data to return.

Oh, it deliberately returns 0 when there's an EOF... see below:

> All I've been able to figure out so far is that within _libssh2_channel_read
> it gets a NULL pointer from the call to _libssh2_list_first on line ~1708.
> Changing the condition as described above just causes it to hit that line
> again and again, getting NULL each time. I'm assuming it's to do with the
> call to _libssh2_transport_read() above not getting any data.

Right, that code reads data off the socket, puts packets in queues for each
channel and the _libssh2_list_first() then returns the first packet for your
channel and when that is NULL there's nothing there to take care of.

In your log you posted there's an interesting EOF just before the -28:

[libssh2] 1.001004 Transport: Packet type 96 received, length=5
[libssh2] 1.001055 Conn: EOF received for channel 0/0
[libssh2] 1.001111 Failure Event: -28 - Timed out waiting for SCP response
[libssh2] 1.001164 Conn: Freeing channel 0/0 resources

... something makes the remote end close the channel!

Received on 2010-10-11