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 16:38:21 +0100 (CET)

On Thu, 20 Dec 2018, Samuel Hurst wrote:

>> 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.
>
> Just to clarify, would building easy handles in another thread cause any
> issues? I'm only doing the actual processing in one thread, but I'm
> calling curl_easy_init and curl_easy_setopt in another and passing it
> between them with a queue.

I think that's safe.

> Looking through the easy code, it seems that it's inserting a SIGPIPE
> handler only when you do easy_perform, although I note that there's one in
> easy_cleanup too, I'm guessing that this is potentially where I'm falling
> foul of this because my code does the cleanup in the same thread that it
> builds the easy handle in the first place?

Exactly! That causes a race for which of them that should set/unset the
(global) SIGPIPE ignore.

-- 
  / 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