Subject: Re: libssh2_sftp_write blocks for about 3 minutes

Re: libssh2_sftp_write blocks for about 3 minutes

From: Pan K <>
Date: Tue, 05 Dec 2017 17:00:59 +0000
Absolutely, however from previous messages in this thread, the select poll libssh2 is using immediately returns 'ready' when the socket is in that state without anything actually being ready to read, which results in a hot loop.
Not sure what could be done to correctly determine the socket is actually in a re-transmission state pending close. But yes, non-blocking mode would only be a work around.
05.12.2017, 16:39, "Daniel Stenberg" <>:

On Tue, 5 Dec 2017, Pan K via libssh2-devel wrote:

 Since the undesirable behaviour is the high CPU usage when the socket is not
 available, would not running the SFTP transfer in non-blocking mode help?  

Busy-looping like that is a bug, so if libssh2 does it it is a bug we should
track down and fix. You could probably use non-blocking mode as a work-around,
as then you can handle the looping in your own code.



Received on 2017-12-05