Subject: Re: libssh2_sftp_write blocks for about 3 minutes

Re: libssh2_sftp_write blocks for about 3 minutes

From: Daniel Stenberg <>
Date: Tue, 5 Dec 2017 21:15:36 +0100 (CET)

On Tue, 5 Dec 2017, Pan K wrote:

> 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.

I maintain it is a bug to act like that. libssh2 should not do that.

I'm sorry, but I haven't really kept up with the details this thread.

> Not sure what could be done to correctly determine the socket is
> actually in a re-transmission state pending close.

If select() / poll() returns at once and says that the socket is readable or
writable, then libssh2 should act on it accordingly to give it a chance to
move from that state. It shouldn't ask for the bits it doesn't want to know
about and for the action it asks for, it should act.

Received on 2017-12-05