Subject: Re: libssh2_sftp_write blocks for about 3 minutes

Re: libssh2_sftp_write blocks for about 3 minutes

From: Jerome Zimmermann <Jerome.Zimmermann_at_ipetronik.com>
Date: Mon, 13 Nov 2017 16:14:41 +0100

Hello,

@Will:
Yes, the suggestion to change the timeout worked fine.
But the problem with the high CPU load remains.

I got new insights about the behaviour that the CPU load remains at 100% in blocking mode.

For the sake of clarity, I will first re-explain the case of the problem.

The application (runs on a RTOS platform) establish a connection to a SFTP-Server
via a modem device (this implies a high latency connection) to send files to the server.
During the transfer I remove the connection cable to the modem antenna.
Then, the CPU loads remains on 100 % for over 3 minutes.

The libssh2 remains in the libssh2_sftp_write function.
More precise, the second do while loop of the BLOCK_ADJUST macro.
Here, function libssh2_wait_socket always returns 0.

Examining the return value of select() reveals that the socket is always
ready for reading or writing even when the physical connection is no longer available.
Further, I verified the socket state with getsockopt() and connect().
But the socket is always in the "connect"-state.

Besides, the keep-alive mechanism of the libssh2 is deactivated.
The socket is in the non-blocking mode and the libssh2 session in the blocking mode.

Is there a way to identify such a "broken connection" to break earlier the loop and so avoid a CPU load of 100% ?

Best regards
Jerome

Impressum/Imprint: https://www.ipetronik.com/impressum

_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2017-11-13