Skip to content

CURLOPT_NOSIGNAL does not work everywhere #3138

@martinus

Description

@martinus

I did this

I use the curl_easy interfaces in 2 threads, and immediately call curl_easy_setopt(curl, CURLOPT_NOSIGNAL);. Eventually, in curl_easy_cleanup the instances are destroyed, where unfortunately sigaction(SIGPIPE, &action, NULL); is called and in our case due to race condition this keeps the SIG_IGN installed if both destructions happen at almost the same time.

Here is the relevant stacktrace:

#0  0xfffffd7fff082824 in sigaction () from /lib/64/libc.so.1
#1  0x000000000095837a in sigpipe_ignore (ig=ig@entry=0xfffffd7ffe6001e0, data=<optimized out>) at sigpipe.h:51
#2  0x0000000000958ee9 in sigpipe_ignore (data=<optimized out>, ig=0xfffffd7ffe6001e0) at conncache.c:604
#3  Curl_conncache_close_all_connections (connc=connc@entry=0x12d0738) at conncache.c:597
#4  0x0000000000952220 in curl_multi_cleanup (multi=0x12d0640) at multi.c:2219
#5  0x000000000096ff8d in Curl_close (data=data@entry=0x12c6f70) at url.c:326
#6  0x000000000094e797 in curl_easy_cleanup (data=0x12c6f70) at easy.c:832

I expected the following

sigaction()should never be called when we use curl_easy_setopt(curl, CURLOPT_NOSIGNAL);

curl/libcurl version

curl-7.61.1

operating system

Solaris, Linux

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions