Subject: [ libssh2-Bugs-2558794 ] libssh2_poll returns 0 sometimes when using select

[ libssh2-Bugs-2558794 ] libssh2_poll returns 0 sometimes when using select

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Sun, 05 Apr 2009 18:29:21 +0000

Bugs item #2558794, was opened at 2009-02-03 01:14
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2558794&group_id=125852

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: API
Group: None
Status: Open
>Resolution: None
>Priority: 3
Private: No
Submitted By: William Boyle (vtcool)
>Assigned to: Daniel Stenberg (bagder)
Summary: libssh2_poll returns 0 sometimes when using select

Initial Comment:
I have encountered an issue where if polling a exec channel for a command like "netstat -a" with libssh2_poll that in some command execution runs, the libssh2_poll will always return 0 and will never change on subsequent polls of the same function on Windows 2003 server.

I have structured my reads to do something like the following:

1) Execute command
2) Read channel first
3) Check if libssh2_poll for availability of data on the channel. If the rc is 0, loop until we get something greater than 0.
4) Continue to read from step 1.

However, in the particular cases where the code execution doesn't successfully return, I get a rc > 0 until a 0 is hit and then it remains 0. I have narrowed it down to the socket select() function on Windows 2003, but am unable to understand why there would be no data available when there is really data available. To me it would seem select() is behaving incorrectly.

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2009-04-05 20:29

Message:
I'm now advocating we deprecate libssh2_poll() completely.

Is there any reason why you don't just use poll() or select() on the
socket libssh2 operates on?

----------------------------------------------------------------------

Comment By: William Boyle (vtcool)
Date: 2009-02-18 03:00

Message:
Not quite, but mine is pretty much the opposite. I know there is data on
the channel, but unfortunately the select function internal to the
libssh2_poll function returns nothing is there from time to time. The only
way that I figured I could workaround this problem is to involve a retry
count of subsequent no interesting events available and kick out and try to
read from the channel again anyways.

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2009-02-18 00:24

Message:
Isn't this a duplicate of the issue in bug 2141548?

https://sourceforge.net/tracker2/?func=detail&aid=2141548&group_id=125852&atid=703942

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2009-02-03 02:25

Message:
You're not the first to observe that Windows and select() are not the best
of friends.

//Peter <peter_at_stuge.se>

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2558794&group_id=125852

------------------------------------------------------------------------------
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-04-05