[TSAN] Use only async signal safe functions in signal handlers#2131
Merged
wezrule merged 4 commits intonanocurrency:masterfrom Jul 10, 2019
Merged
[TSAN] Use only async signal safe functions in signal handlers#2131wezrule merged 4 commits intonanocurrency:masterfrom
wezrule merged 4 commits intonanocurrency:masterfrom
Conversation
5bc2fb5 to
8352a64
Compare
8352a64 to
c8f4563
Compare
argakiig
approved these changes
Jul 8, 2019
clemahieu
approved these changes
Jul 9, 2019
cryptocode
approved these changes
Jul 9, 2019
SergiySW
approved these changes
Jul 10, 2019
argakiig
pushed a commit
that referenced
this pull request
Jul 10, 2019
* Use only async-signal-safe functions in signal handlers * Fix load-tester race * Use consistent code when outputting load addresses
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.
Very little is allowed in signal handlers, specifically only async-signal-safe functions. This is because code can be halted at any point, if a mutex is already locked elsewhere for instance this will result in deadlock. TSAN gives many warnings when closing the daemon when the SIGTERM/SIGINT and SIGSEGV signals are raised. Instead of calling our application specific code in the signal handler I just stop the io_context (which is done in a few asio examples), the rest of the cleanup code is now done by checking a
sigatomic_tvariable after the asio loop has finished.Now also using specific Linux file descriptor commands which are known to be async-signal-safe (looked at how the boost stacktrace dump does it as it states signal safety) in the segfault/abort signal handler.
(Unrelated) I noticed 2 places where there was an unnamed
std::lock_guardbeing used.