curl / Mailing Lists / curl-library / Single Mail

curl-library

RE: sftp upload request hangs with a high latency server using multi interface

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 14 Feb 2019 23:53:42 +0100 (CET)

On Thu, 14 Feb 2019, Ketul Barot via curl-library wrote:

> Just 1 log before it calls libssh2_session_disconnect and 1 after the
> function call. I am seeing that whenever it hangs it doesn’t print both the
> logs it only prints the 1st which is “Entering libssh2_session_disconnect”
> so definitely the transfer is getting hang in libssh2_session_disconnect.
>
> Any further debugging would greatly help 😊

Try adding a call to *set_timeout() just before we call
libssh2_session_disconnect() to instruct libssh2 to give up the waiting after
2 seconds. Like this:

diff --git a/lib/ssh.c b/lib/ssh.c
index 8c68adcc1..a5f69ac08 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -2583,10 +2583,11 @@ static CURLcode ssh_statemach_act(struct connectdata
*conn, bool *block)
          }
          sshc->ssh_channel = NULL;
        }

        if(sshc->ssh_session) {
+ libssh2_session_set_timeout(sshc->ssh_session, 2L);
          rc = libssh2_session_disconnect(sshc->ssh_session, "Shutdown");
          if(rc == LIBSSH2_ERROR_EAGAIN) {
            break;
          }
          if(rc < 0) {

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-02-14