cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl: Transfer() timeout bug?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 29 Oct 2001 11:28:28 +0100 (MET)

On Sat, 27 Oct 2001, Pawel A. Gajda wrote:

(Please post follow-ups to the libcurl mailing list, this is a team effort!)

> > But... that's the intended functionality! That is the timeout option, it
> > prevents any transfer to take any longer time than specified!
>
> Well, I didn't catch the intetion... Anyway IMHO it is unneeded and
> sometimes bad functionality, the default timeout is an hour, but download
> huge file (e.g. iso img) with 3 kB/s speed takes more than hour. In
> general transfer time depends on it's size and bandwith, so aribitrary
> timeout on file transfer makes no sense to me...

The default 3600 second timeout you talk about is used in the
Curl_GetFTPResponse() function and means that it times out if if hasn't read
an FTP server response within an hour. That is not the same as not having
read the entire file within that time. FTP responses are generally very small
and I can't think of any situation with any tiny pipe when 3600 would be a
too small value. Can you?

Ah, is it when used within the Curl_ftp_done() function you experience this
problem? I can see now how that is a problem... Since it'll make the
response-read timeout immediately if the FTP transfer took a very long time.
I think I better remove that default timeout or enlarge it...

The general timeout for long transfers are checked for in Transfer() and if
you don't want a timeout for the transfer, then don't set it. It is entirely
optional.

It was added once upon the time due to requests.

> Anyway AFAIK there is no possibility to set timeout on read(), what is
> very useful to me

Only using alarm(), but that won't do on multi-threaded uses. Also, there
shouldn't be any "hangs" on read() in curl once the transfer has started, as
it select()s until it can read data. Your problem will probably appear when
the network goes down to a crawl and (next to) nothing is ever read. Then
it'll take forever.

But then, you could use the speedcheck to abort if the speed is slower than a
certain speed for a given period.

> we (PLD - http://www.pld.org.pl) use curl in installer for downloading
> packages of Linux distribution and without timeout all hangs.

So why don't you set a timeout?

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-10-29