Ticket #123 (closed defect: invalid)

Opened 8 years ago

Last modified 7 years ago

libssh2_channel_close() hangs in non blocking mode

Reported by: anonymous Owned by: bagder
Priority: normal Milestone:
Component: Version: 1.2.1
Keywords: Cc: bagder
Blocked By: Blocks:



I am having problems with non responding connections again. I am using libssh2-1.2.1. I am always using the non blocking mode for all the libssh2 functions, and the socket is created with a timeout. All the libssh2 functions are executed in a loop that reruns it until the result is not EAGAIN and it exists after few seconds anyway so that it does not hang. It works well for all the initialization and the read/write libssh2 functions.

The problem is now the program is hanging in libssh2_channel_close(), and the session/channel is still in non-blocking mode. It sounds the problem is the big "do { ... } while(1)" loop in _libssh2_transport_read(). The socket is broken and this function will try to read something forever. It has been hanging for at least 60 seconds, and then a monitor decided to stop the program, so that we get the backtrace:

(gdb) bt
#0 0x00007f4c7be47221 in _libssh2_transport_read (session=0x7f4c74047270) at transport.c:312
#1 0x00007f4c7be2fe4c in channel_close (channel=0x7f4c7400df70) at channel.c:2276
#2 0x00007f4c7be30090 in libssh2_channel_close (channel=0x7f4c7400df70) at channel.c:2307
#3 0x0000000000413b1d in connpool_internal_repairifbroken (cp=0x629c50, descriptor=4308,

reconnected=0x426b3e5c, monname=0x426d4a20 "mon4")

Is there a workaround for this problem ? If not I think we should implement a default timeout in _libssh2_transport_read().


Change History

comment:1 Changed 8 years ago by bagder

I don't understand. Why would it hang in _libssh2_transport_read() ? It uses non-blocking sockets so no recv() call should ever hang. Can you see it get stuck in the do-while loop somehow?

comment:2 Changed 7 years ago by bagder

  • Version set to 1.2.1

Can you still repeat this problem with libssh2 1.2.4?

If so, can you please provide the source code to an application that repeats this problem?

comment:3 Changed 7 years ago by bagder

  • Resolution set to invalid
  • Status changed from assigned to closed

It is really a strangely put problem and there's no feedback on the problem even after a very long time. I'm closing this as invalid.

Note: See TracTickets for help on using tickets.