curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. 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 Daniel himself.

Re: crash in Curl_getaddrinfo_ex using libcurl 8.11.1

From: Dimitry Andric via curl-library <curl-library_at_lists.haxx.se>
Date: Sat, 22 Mar 2025 09:46:20 +0100

On 22 Mar 2025, at 01:38, Vadim Grinshpun via curl-library <curl-library_at_lists.haxx.se> wrote:
>
> A program that has been happily using libcurl for years
> started crashing when we upgraded libcurl from 8.10.1 to 8.11.1.
>
> I was hoping the good folks here might be able
> to point me in the right direction; the crash is within a libcurl getaddrinfo call.
> A sample gdb stack trace is at the end of the email.
>
> - the OS is Ubuntu 22.04.5 LTS.
> - there were no code changes in the program, just dependency updates
> - the program is multi-threaded
>
> Based on the fact that 'getaddrinfo' is mentioned in the stack trace, I wonder if this is somehow related
> to a PR that was merged into 8.11.0: https://github.com/curl/curl/pull/15475
>
> Thanks for any help! And let me know if any other information would be useful.
>
> -Vadim
>
> --snip--
> Program terminated with signal SIGABRT, Aborted.
> #0 0x00007fbd93e96a7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
> [Current thread is 1 (Thread 0x7fbd849fa640 (LWP 1673034))]
> (gdb) where
> [custom signal handler bits removed for brevity]
> #5 0x00007fbd93e96a7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
> #6 0x00007fbd93e42476 in raise () from /lib/x86_64-linux-gnu/libc.so.6
> #7 0x00007fbd93e287f3 in abort () from /lib/x86_64-linux-gnu/libc.so.6
> #8 0x00007fbd93e8945c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
> #9 0x00007fbd93e89770 in __libc_fatal () from /lib/x86_64-linux-gnu/libc.so.6
> #10 0x00007fbd93f446af in __netlink_assert_response () from /lib/x86_64-linux-gnu/libc.so.6
> #11 0x00007fbd93f43e1e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
> #12 0x00007fbd93f0bd71 in getaddrinfo () from /lib/x86_64-linux-gnu/libc.so.6
> #13 0x0000556ae604a3d8 in Curl_getaddrinfo_ex (nodename=<optimized out>, servname=servname_at_entry=0x7fbd849f5cfc "443", hints=hints_at_entry=0x7fbd91248b50,
> result=result_at_entry=0x7fbd91248b48) at curl_addrinfo.c:121
> #14 0x0000556ae603b73d in getaddrinfo_thread (arg=arg_at_entry=0x7fbd91248b18) at asyn-thread.c:311
> #15 0x0000556ae604aaff in curl_thread_create_thunk (arg=<optimized out>) at curl_threads.c:59
> #16 0x00007fbd93e94b43 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
> #17 0x00007fbd93f26990 in ?? () from /lib/x86_64-linux-gnu/libc.so.6

In my experience, this indicates that some other thread is accidentally
closing the file descriptor that getaddrinfo uses internally to
enumerate the interfaces. Typically, because of a double-close of an
unrelated file descriptor.

Maybe you can install the libc6-dbg package, to get some more
information about the functions marked with "??" in the stack trace?
That would make it easier to determine whether a close-race is the cause
of the crash.

-Dimitry

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2025-03-22