cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl crashes when running inseparate thread with request timeout set

From: Dima Tisnek <dimaqq_at_gmail.com>
Date: Tue, 25 May 2010 23:28:20 +0300

IIRC the solution was to build curl with c-ares and use CURLOPT_NOSIGNAL.

The underlying reason being that normal timeout handling uses alarm() which
in turn uses setlongjump which is not safe if the timeout happens in e.g.
libc resolver, CMIIW.

Cheers,
Dima Q

2010/5/25 Никита Дорохин <kit-d_at_ukr.net>

> Hi
>
>
>
> I observe strange behaviour which has to do with libcurl (7.15.5, but the
> same with 7.20) on Linux (RHEL 5).
>
>
>
> I have an application with 2 thread running. At some point first thread
> sends a message to second thread to
>
> get HTTP page. When second thread receives the message it initializes
> libcurl and sends HTTP GET request
>
> with CURLOPT_TIMEOUT set to 30 sec.
>
>
>
> Everything is OK up t the moment when I unplug ethernet cables and restart
> the application. Name resolving fails, I get:
>
>
>
> * name lookup timed out
> * Couldn't resolve host 'google.com'
> * Closing connection #0
> * couldn't resolve host name
>
> After that looks like main thread is not running anymore. It has continious
> debug printf but no message observed
>
> after timeout in second thread occured.
>
>
>
> If I disable CURLOPT_TIMEOUT and restart the application everything works
> as expected.
>
>
>
> Please, help me with the problem.
>
>
>
> Nikita.
>
>
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-25