curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: SIGPIPE when using libcurl with OpenSSL on Fedora 28

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 20 Dec 2018 08:42:38 +0100 (CET)

On Wed, 19 Dec 2018, Samuel Hurst via curl-library wrote:

> I was not aware that this was a requirement on multi-threaded applications.
> The CURLOPT_NOSIGNAL API documentation [1] does not reference this
> requirement at all, which is why I've missed it.

I should clarify in there!

> My application is multi-threaded, but I have a dedicated thread just for
> running curl in - there should never be another thread which calls
> curl_multi_perform. Would I need to set CURLOPT_NOSIGNAL even in this case?

If you're only using curl in a single thread then you're fine to use
CURLOPT_NOSIGNAL I think. Unless you need SIGPIPE (filtering) for something
else.

The issue when using CURLOPT_NOSIGNAL when using curl from multiple threads is
that curl needs to ignore the signals but it can't do it globally for the
process so it will set the ignore the entry and clear it again on exit. But
signals are global per process so if you then invoke curl multiple times
within the process, the ignoring/clearing of signals end up in a race.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-12-20