curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Question about curl timeout when NOSIGNAL is set

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 15 Aug 2017 13:31:56 +0200 (CEST)

On Tue, 15 Aug 2017, Chenchen Qu wrote:

> I recently came across some crashes from my muti threaded application and it
> turned out I don't have the CURLOPT_NOSIGNAL and signal was causing some
> weird behaviour in my application.

Signals and threads usually don't mix very well.

> I apologize if this question was answered before, would CURLOPT_TIMEOUT and
> CURLOPT_CONNECTTIMEOUT still work with signal disabled?

Partly. The timeouts cannot abort a slow name resolve with the synchronous
name resolver when signals are disabled, but they work just as fine in all
other aspects.

> How would it work without using the OS SIGALRM?

A signal is the only way to abort the stock resolver functions.

> I guess I should build libcurl with c-ares or threaded-resolver support if I
> want the timeout To work properly.

Yes, exactly. They resolve names asynchronously, which you want if you use the
multi interface for example.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-08-15