Subject: Re: libssh2_sftp_close

Re: libssh2_sftp_close

From: Daniel Stenberg <>
Date: Tue, 20 Jul 2010 22:38:26 +0200 (CEST)

On Mon, 19 Jul 2010, Michael Heese wrote:

> We seem to be experiencing a problem with the libssh2_sftp_close() function.
> The first time I call this function it works fine. However, any calls to it
> after that cause it to block and hang forever.

I assume you close a second sftp handle then? Can you please provide a small
example repeating the problem?

Do you use OpenSSL or gcrypt? Does it always happen and does it depend on a
particular sftp server flavour? What target operating system are you running
this on?

> The problem seems to be in the _libssh2_wait_socket() function in session.c.
> The select() function at the bottom is being passed NULL, which causes this
> function to block infinitely. If I hardcode a value, say 10 seconds, this
> seems to fix the problem but I would rather not hardcode a timeout value as
> this causes other calls to delay as well.

That would be the sympthom of the problem, not the source for it...

Received on 2010-07-20