Subject: intermittent channel read problems

intermittent channel read problems

From: Jeremy Knope <>
Date: Tue, 14 Apr 2009 15:31:27 -0400

Hey all, I got a bit of a problem with trying to setup a small app
that executes commands on a remote host via libssh2 and reads the data
outputted. I've been testing this against my local machine and
servers on the local network. What happens is very so often a command
I execute returns 0 bytes of data and a status of 0, but then I can
execute the command again and I might get results on the 2nd try.
Occasionally it might actually block on the read command (via

In my sample app, every time I execute a command, a channel via
libssh2_channel_open_session() is opened and command is executed via
libssh2_channel_exec(). I'm also running everything in blocking mode.

I've been scratching my head on this a while and haven't been able to
figure out what might be going on. The only time it seems to work
100% reliably is if I turn logging on my local sshd to DEBUG3. I
haven't had any issues when it's set to that which seems kind of odd.

Any help is appreciated, if you need to see some code, would you
prefer it on a paste site or just attached?

Jeremy Knope / Software Developer / Ambrosia Software, Inc. --
This email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
libssh2-devel mailing list
Received on 2009-04-14