Ticket #120 (closed defect)
libssh2_session_startup may hang
|Reported by:||anonymous||Owned by:||bagder|
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:
#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.