curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Periodic segfault in curl_easy_perform()

From: Adrián Gimeno Balaguer via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 10 Feb 2021 13:35:58 +0100

Hello there,

 

I have an infinite loop based program that, on a configured period basis (currently 60 seconds), sends files over CURL to a web server, via HTTPS. Problem arises on Linux at least (CentOS 7.9 server)

 

The program crashes after 5-10 minutes since startup (provided the periodic check always sends files) at curl_easy_perform() with the following stack trace:

 

Program terminated with signal 11, Segmentation fault.

#0  0x00007ff9f8cddaec in free () from /lib64/libc.so.6

(gdb) bt

#0  0x00007ff9f8cddaec in free () from /lib64/libc.so.6

#1  0x00007ff9f984e3a1 in pthread_create_at__at_GLIBC_2.2.5 () from /lib64/libpthread.so.0

#2  0x00000000004b315c in Curl_thread_create ()

#3  0x00000000004afefe in Curl_resolver_getaddrinfo ()

#4  0x00000000004979bc in Curl_resolv ()

#5  0x000000000049646f in Curl_connect ()

#6  0x00000000004a05a2 in multi_runsingle ()

#7  0x00000000004a1186 in curl_multi_perform ()

#8  0x0000000000492e58 in curl_easy_perform ()

 

The crash delay directly depends on deliverable files being found or not on each period, so that the program seems to be always stable when there are never files to send (best case). I’m not using any pthread other than the one CURL creates to handle timeouts (I believe):

 

(gdb) i threads

  Id   Target Id         Frame

  2    Thread 0x7ff9f8a44700 (LWP -1) PC register is not available

 

I’m linking the program against a static self-built CURL library on a CI/CD, with the following compilation line:

 

cmake -Bbuild -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_CRYPTO_AUTH=ON -DCURL_DISABLE_LDAP=ON -DCURL_DISABLE_PROXY=ON -DENABLE_IPV6=OFF -DENABLE_UNIX_SOCKETS=OFF -DHTTP_ONLY=ON -DOPENSSL_CRYPTO_LIBRARY=$(Pipeline.Workspace)/ssl/lib/libcrypto.so.1.1 -DOPENSSL_INCLUDE_DIR=$(Pipeline.Workspace)/ssl/include -DOPENSSL_SSL_LIBRARY=$(Pipeline.Workspace)/ssl/lib/libssl.so.1.1 -DZLIB_INCLUDE_DIR=$(Pipeline.Workspace)/zlib/include -DZLIB_LIBRARY=$(Pipeline.Workspace)/zlib/lib/libz.so.1 . && cmake --build build

 

Version dump using curl_version():

 

libcurl/7.74.0-DEV OpenSSL/1.1.1i zlib/1.2.11

 

I have been having program crashes possibly related to CURL for long enough -not sure if including the same stack trace- when I was using a different version as well, and I expected upgrading it perhaps would solve it. So I’m very concerned about possibly having an undefined behavior. Note I believe it isn’t a deterministic crash.

 

What could I be doing wrong? Thank you,

 

Adrián

 


-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-02-10