cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Bug in sftp timeout detection.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 5 Jan 2011 14:15:46 +0100 (CET)

On Wed, 5 Jan 2011, Skrzyniarz Alexandre wrote:

(I'm CC'ing this response to the curl-library mailing list which is the more
correct list to have this conversation on. Please consider continuing it
there!)

>>>> Timeout setting with -Y and -y options doesn't work with sftp
>>>> protocol.
>
> I had some time to track this issue: the download is not aborted because
> there is an infinite loop in ssh_easy_statematch when ssh connection state
> is SSH_SFTP_SHUTDOWN.
>
> By the way, there is a similar problem with ssh (infinite loop with state
> SSH_SESSION_HANDLED).
>
> And for the progress meter: It updates itself with SFTP, but is stuck with
> SSH after authentication.
>
> This simple patch fixes the timeout (I guess there is a more graceful
> way to handle disconnections):

Thanks for your work on this and your patch that tries to address it.

However, this patch is wrong in at least two accounts:

First, it doesn't actually fix the problem with -y and -Y, as then you'd
instead make sure you call the necessary functions to evaluate the condition
and only if met it should break the loop.

Secondly, you can't have the loop blindly aborted like that as the disconnect
state must be allowed to take a while to finish (at least several seconds). I
figure we should rather introduce some kind of timeout for some of the states
so that if a single transient state remains for a certain time we assume
something wrong happened and we bail out.

Your details and work did however push me in the right direction I believe and
I think the attached patch is what will make -y/-Y to start working again for
this particular case. Please try it out and tell me how it works, I didn't
really test it myself yet.

Although we should still have a way to bail out from "locked" states such as
this one so that the -y/-Y work-around won't be necessary to trap this
situation.

Are you interested in working on a "real" fix for this?

-- 
  / daniel.haxx.se


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2011-01-05