-
Notifications
You must be signed in to change notification settings - Fork 352
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
Add random failures to compare_exchange_weak #1686
Conversation
|
I got a comment elsewhere about it being unfortunate that this triggers even if no other atomic operations are happening that involve the atomic variable. For future reference, and for anybody else with the same concern: That is realistic, because on (some/most) real hardware these failures are triggered by operations by another thread on the same cache line (which might not even be part of the same allocation, let alone the same atomic). Also, all the descriptions of this in specifications I found put no bounds on when these are allowed to fail, just that they are allowed to fail randomly. The one caveat here is that under |
Just to check, this isn't waiting on anything from me right? |
Nope, I just forgot about it. Thanks for the PR and the reminder! @bors r+ |
📌 Commit d310620 has been approved by |
☀️ Test successful - checks-actions |
In practice this is pretty useful for detecting bugs.
This fails more frequently than realistic (
50%(now 80%, controlled by a flag) of the time). I couldn't find any existing code that tries to model this (tsan, cdschecker, etc all seem to have TODOs there). Relacy models it with a 25% or 50% failure chance depending on some settings.CC @JCTyblaidd who wrote the code this modifies initially, and seems interested in this subject.