Subject: Re: libssh2_channel_close/libssh2_channel_free hangs if you execute long-running command

Re: libssh2_channel_close/libssh2_channel_free hangs if you execute long-running command

From: Pavel Strashkin <pavel.strashkin_at_gmail.com>
Date: Thu, 13 Oct 2011 19:28:14 -0700

> Of course not, when the remote program still has the channel open?

Remote or local doesn't matter. It's just a pipe. I can close (should
be able) it at any time. Actually, channel is closed after [interval]
seconds. The question is why it waits for anything to read before
closing. Be patient. After [seconds] program is still running. In
theory libssh2 would hang forever, but it doesn't.

> A proper solution would of course be to first kill the remote
> program. Maybe you will not bother.
I don't mind to do it, but i don't have necessary tools. There is no
kill or similar function in a library. I don't mind to use the close
call directly either. I reported just because i think it's
unexpectable behavior and people should know about it.

2011/10/13 Peter Stuge <peter_at_stuge.se>:
> Pavel Strashkin wrote:
>> Here we go. I read first block of data, then command "sleeps" for a
>> [interval] seconds, i do libssh2_channel_close or
>> libssh2_channel_free, and it hangs for [interval] seconds. I can't
>> close channel or session graceful.
>
> Of course not, when the remote program still has the channel open?
>
>
>> As a workaround i do close on a socket directly before closing
>> channel/session.
>
> A proper solution would of course be to first kill the remote
> program. Maybe you will not bother.
>
>
> //Peter
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-10-14