Repository navigation
Update appbase for POSIX signal handling - #364
Merged
Merged
Conversation
heifner
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Update the
libraries/appbasesubmodule to the merged commit from Wire-Network/appbase#5.What changed
libraries/appbaseto104ec22e68d9247a19a71e4f8e115652d023c7d7.Use sigwait for POSIX signal handling.Why
Wire-Network/appbase#5 replaces appbase's Boost.Asio signal handling with a POSIX
sigwait-based signal thread.The old appbase implementation relied on a fragile per-thread signal-mask invariant: appbase created one signal-catching thread before blocking
SIGHUP,SIGINT,SIGTERM, andSIGPIPEin the rest of the process, then assumed that thread would keep those signals unblocked for the lifetime of the process.The macOS failure investigation showed that this invariant can be lost after startup. In an instrumented old-Asio run, the signal-catching thread initially started with those signals unblocked, but later reported the same target set as blocked:
INT=1 TERM=1 PIPE=1 HUP=1. The thread was still alive inside its dedicated Asioio_context/kqueue loop, but it was no longer eligible to receive appbase's shutdown/reload signals. After that point, process-directedSIGTERM/SIGHUPstayed pending, no Asio signal-handler entry was logged, no appbaseasync_waitcallback ran, and appbase never calledquit().The appbase fix moves to the standard POSIX
sigwaitmodel:sigwait.sigwaitsynchronously consume pending process-directed signals from that blocked set.With
sigwait, the appbase signal thread no longer needs to preserve a special unblocked mask. The blocked mask is the expected state, and the waiter thread runs only the narrowsigwaitloop rather than a full Asio reactor loop.SIGHUPcontinues to dispatch through appbase's reload path,SIGINT/SIGTERMrequest graceful quit, andSIGPIPEis explicitly ignored.The appbase investigation also ruled out the reachable in-process candidates as necessary writers for the old mask flip: sys-vm
invoke_with_signal_handlermask operations, Boost.Asioposix_signal_blockeron the signal thread, Boost.Asio scheduler own-threadsignal_blocker, fork-only Asio masking, and non-macOSselect_reactorpaths. Identifying the remaining writer is a useful follow-up, but this submodule update does not depend on it because thesigwaitdesign removes appbase's dependency on an unblocked signal owner.Related PRs
Testing
Validation performed for Wire-Network/appbase#5 before this submodule update:
cmake --build build/macos-arm64-ci-repro --target appbase_test custom_appbase_testappbase_test --run_test=posix_signal_handling --report_level=detailed --color_output=noappbase_testpassed before the final rebasecustom_appbase_testpassed before the final rebaseio_context, and then stopped receivingSIGTERM/SIGHUPposix_signal_blockerprobe logged zero signal-thread entries before the abort-trap detectioninvoke_with_signal_handlermask-operation ablation did not prevent the invariant failuresignal_blockerablation did not prevent the invariant failureappbase_testpassedcustom_appbase_testpassedposix_signal_handlingpassedNo additional sysio test was run for this PR after the final pointer-only update to the appbase merge commit.