www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: libssh2_sftp_write blocks for about 3 minutes

Re: libssh2_sftp_write blocks for about 3 minutes

From: Pan K <zuboci_at_yandex.com>
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" <daniel@haxx.se>:

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.


  / daniel.haxx.se

libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2017-12-05

the libssh2 team