cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Early initialization errors

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 7 Mar 2012 23:31:16 +0100 (CET)

On Tue, 6 Mar 2012, René Berber wrote:

> The problem: A http connection is being aborted in libcurl with the
> CURLE_FAILED_INIT error code. The problem is caused by the server having
> DNS based redundancy, in this case hosts returns 8 IPs (non distinct, 1
> repeats), resulting in a very short time-out which I think causes a signal
> when libcurl is just starting.
>
> I understand, from reading other posts, that the CURLOPT_TIMEOUT which in
> this case is set to 30 sec is being divided by 8, so the real time-out used
> is 3.75 sec.

This particular problem was addressed with commit f4d3c0cbfb648917a0 but it is
not yet present in any release. You could try it out though, either by
cherry-picking the commit or by running a recent daily snapshot or git build.

> I wouldn't mind modifying libcurl to leave the CURLOPT_TIMEOUT alone, in
> this use case it doesn't make sense connecting to all IPs, or modifying the
> timeout (I do understand the logic behind that decision, you do not want to
> have say 8 times the timeout if each IP is tried one after the other, but
> they are tried in parallel if I understood the documentation).

No, they are tried sequentially and the CURLOPT_TIMEOUT is documented to be
the maximum timeout libcurl should allow the entire operation to take so the
code really has to do some kind of "clever" choice.

The new way will at least be a lot different and should avoid this problem to
a much larger extent.

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-07