-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ore: make halt!
use _exit
to avoid exit handler races
#27705
Conversation
halt!
use _exit
to avoid exit handler races
"Longer Zippy ClusterReplicas" still fails, but not with a segfault anymore. Instead it seems to run into a thread limit, which likely unrelated. |
/// | ||
/// This function exists to avoid that all callers of `halt!` have to explicitly depend on `libc`. | ||
pub fn halt() -> ! { | ||
unsafe { libc::_exit(2) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO(@teskje) some documentation about the use of _exit
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo your TODO to add a comment about _exit
. Really nice find on this one! 🙇🏽
@MaterializeInc/testing The second PR re-enables the "Longer Zippy ClusterReplicas" test in the Release Qualification pipeline. Given that it failed once with an unrelated error, should I drop that commit? If I do the "references to already closed issues" check might start triggering on this. |
Go ahead, feel free to re-enable that check. We can disable it again if we see that further causes make it fail. |
This PR fixes a soundness hole introduced by multiple threads calling
halt!
at the same time, thereby invoking the thread-unsafe libcexit
function concurrently, which would lead to use-after-frees and resulting segfaults. The fix is to call_exit
instead, which is thread-safe.We can consider reverting this once rust-lang/rust#126600 is resolved.
Motivation
Fixes MaterializeInc/database-issues#6528
Checklist
$T ⇔ Proto$T
mapping (possibly in a backwards-incompatible way), then it is tagged with aT-proto
label.