Subject: Re: Strange: libssh2_channel_read() returns 0

Re: Strange: libssh2_channel_read() returns 0

From: Jeremy Knope <jerome_at_ambrosiasw.com>
Date: Thu, 30 Apr 2009 09:41:04 -0400

I just tried CVS with my OS X machines, this seems to fix the problem
for me ONLY if I'm doing sleep(1) before I read. Otherwise there's
risk of the read blocking permanently and I have to kill the
application.

Any reason why this blocks but doesn't eventually return? maybe I just
need to do a different approach. Right now I'm using a call that
reads up to 4096 bytes, calls libssh2_channel_read (in blocking mode)
until it returns 0 bytes. In my test case, I was running a command
that produces 879 bytes. When it locked up, it was on the 2nd call to
read where it would be expected to just return 0 but instead it's
waiting for more data which none will come, or so I assume.

thoughts? Is it better to use the non-blocking method maybe? This
was how we were using it before with 0.13 with some success, but if
it's better I can switch. 1.1 has a lot of improvements so wouldn't
mind.

--
Jeremy Knope / Software Developer / Ambrosia Software, Inc. -- http://www.AmbrosiaSW.com/
On Apr 30, 2009, at 6:32 AM, Daniel Stenberg wrote:
> On Wed, 29 Apr 2009, double wrote:
>
>> This issue may be reproduced via the attached c-file. If the  
>> "sleep(3)"
>> right before "libssh2_channel_read()" is removed, everything works  
>> fine.
>
> I could reproduce it. I tracked it down. I committed a fix. It  
> doesn't happen
> any more for me.
>
> Please give the CVS version a shot and see if it works for you too  
> now!
>
> Thanks for the nice bug report!
>
> -- 
>
>  / daniel.haxx.se
>
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations
> Conference from O'Reilly Media. Velocity features a full day of
> expert-led, hands-on workshops and two days of sessions from industry
> leaders in dedicated Performance & Operations tracks. Use code  
> vel09scf
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> _______________________________________________
> libssh2-devel mailing list
> libssh2-devel_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libssh2-devel
>
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-04-30