Luke Gruber f100298e28
ext/socket: Set raddrinfo thread as detached before thread start (#15142)
We were seeing segfaults when calling `pthread_detach`. Apparently in
some versions of glibc there is a race between when this is called
(usually right after starting a thread) and a short-lived thread's
shutdown routine. The bug has been reported to glibc:

https://sourceware.org/bugzilla/show_bug.cgi?id=19951

I haven't been able to reproduce it on my Linux desktop but apparently
it's easier to reproduce on certain kinds of servers.

As a workaround, we can set the thread's detach state before thread
start. I don't know of a platform that doesn't have
`pthread_attr_setdetachstate`, but to be safe we check for it in
`extconf.rb` and use `pthread_detach` as a backup if it isn't available.

Fixes [Bug #21679]
2025-11-13 16:42:38 -05:00
..
2025-09-13 16:32:30 +09:00
2025-09-13 16:32:30 +09:00
2025-10-23 09:16:15 +09:00