Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
-
Patch
Description
When I ran qdrouterd with perf and pressed Ctrl+C, perf would send SIGTERM as well as SIGINT right after each other to the router.
Scenario:
The first thread would pick up and handle the first signal in handle_signals_LH(). However, within the function, it unlocks the qd_server->lock before calling the registered handler.
When it unlocks this lock, some other thread will pick up the second signal and jump into the qd_server_pause() code, where it will wait indefinitely for threads to pause (I saw this in GDB, where 1 thread was 'missing', and all others marked as canceled). The original handler will have canceled the thread trying to pause all others, but it is not able to jump out.
Patch: https://github.com/apache/qpid-dispatch/pull/95
This patch ensures that only 1 signal handler can run at a time, which fixes the issue for me. Note that it will still potentially mask signals while handling a signal, but the current set of signals (SIGHUP, SIGQUIT, SIGINT, SIGTERM) either shutdown the router or do nothing.