cURL / Mailing Lists / curl-library / Single Mail

curl-library

bug in curl when using threaded resolver but no IPv6 since 7.34.0, all connections time out

From: Fabian Frank <fabian.frank.de_at_gmail.com>
Date: Tue, 7 Jan 2014 18:52:17 -0800

Hi Guys,

My colleague Eric and I are using libcurl and think we have found a bug in the way cURL connects to other hosts. The bug in question results in the following error:
$ src/curl --connect-timeout 5 www.yahoo.com
curl: (28) Connection timed out after 5520 milliseconds

The error reproduces for both the current master as well as the tag curl-7_34_0 of https://github.com/bagder/curl/, when curl is built using the following settings:
$ ./configure --enable-static --disable-shared --disable-ldap --enable-threaded-resolver --disable-ipv6
(using static instead of shared to be able to easily run the resulting binary, disabling ldap support due to some missing header on the box where the compilation happens)

As soon as either the threaded resolver is disabled or IPV6 enabled in the configure command, the resulting curl binary connects and fetches data just fine. We were able to reproduce the bug on MacOS 10.9.1 and Android 4.4 on armv7s. We were not able to reproduce the bug on both Ubuntu 13.10 x86_64 and Ubuntu 13.10 i686.

Using git bisect we were able to isolate the following commit:
https://github.com/bagder/curl/commit/02fbc26d59c59170fd358034b04a43d8e9b7c78f
Revisions before this commit compile and run fine with the configure line shown above, this revision and the following ones always time out. We bisected curl-7_33_0..HEAD and our test command was
$ make -j 7 && src/curl --connect-timeout 1 www.yahoo.com

We were not able to isolate the root cause in the diff of the mentioned commit, but suspect that the error might have something to do with the happy eyeballs implementation, see
https://github.com/bagder/curl/commit/02fbc26d59c59170fd358034b04a43d8e9b7c78f#diff-87cf5b59f2b33ac091768f84dae9867bR557
since it makes use of IPv6 but is not guarded with an ifdef like other parts in the code that deal with IPv6.

We ultimately solved the issue by building cURL with IPv6 support in our project, which we probably should have done in the first place anyways. Please let me know if you need more input to reproduce the issue.

Regards,
Fabian
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-08