Ericsson / xcm

The Extensible Connection-oriented Messaging (XCM) library.
BSD 3-Clause "New" or "Revised" License
16 stars 4 forks source link

Glibc resolver thread steals UNIX signals from application #70

Closed m-ronnblom closed 1 year ago

m-ronnblom commented 1 year ago

glibc's getaddrinfo_a() function is used by XCM to perform asynchronous DNS name resolution. getaddrinfo_a() spawns off a background thread. For reasons unknown, this thread enables all UNIX signals and thus may well be consuming signals it has no clue how to handle.

For example, consider an application which installs a TERM signal handler on one of its threads (and blocks this signal on all other thread). The TERM handler perform an orderly shutdown. In case a TERM is sent to the application's process and it has an ongoing DNS resolution, the signal may well be received by the resolver thread, and the application then goes on to terminate without having perform the necessary clean-up actions.

m-ronnblom commented 1 year ago

Fixed in 2bd8cf63be608ae104dce5e06c5d6d16ab9c4dea.