Bugs item #2871334, was opened at 2009-10-01 16:32
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2871334&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: Invalid
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Daniel Stenberg (bagder)
Summary: libssh2_session_startup may hang
Initial Comment:
Hi,
Our application has been hanging in libssh2_session_startup quite a long time.
It's probably a consequence of a
network issue (the connect() function worked so the network issue probablty
happened between these two functions)
The application has been not responding for more than 60 seconds, and it has
been restarted automatically by a monitor.
Fortunately a backtrace has been generated:
(gdb) bt
#0 0x00007ffeae99cce2 in select () from /lib/libc.so.6
#1 0x00007ffeaec3a458 in _libssh2_wait_socket (session=0x7ffea801a7d0) at
session.c:520
#2 0x00007ffeaec3ad46 in libssh2_session_startup (session=0x7ffea801a7d0,
sock=15) at session.c:687
I cannot see any timeout in the select(). The problem is we cannot control how
much time it may take. We
have used setsockopt to set a read/write timeout on the socket we pass to
libssh2, but the socket timeouts
have no effect with select.
So would it be possible to add an extra argument to libssh2_session_startup()
so that we can have
a timeout and we can just return and error instead of hanging. We are using
libssh2-1.2.
Thanks
----------------------------------------------------------------------
>Comment By: Daniel Stenberg (bagder)
Date: 2009-10-01 20:04
Message:
This isn't a bug actually. It's simply so that the blocking interface for
libssh2 has no timeout anywhere, so all blocking functions do risk to
"hang" for a very long time if there's no network activity.
As the comment in _libssh2_wait_socket() says:
/* Note that this COULD be made to use a timeout that perhaps could
be
customizable by the app or something... */
but I think that rather than adding a timeout to a single function, it
should rather be something more generic so that all blocking functions
would get benefit from such a timeout.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2871334&group_id=125852
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel