-
Notifications
You must be signed in to change notification settings - Fork 354
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
Data race false positive on once_cell #1643
Comments
@JCTyblaidd could you have a look at this? |
The error message is curious:
So this corresponds not to a "normal" memory access but to an access that is implicitly performed by validation. This is probably related to the I noticed the call has an However, validation doesn't descent through references, so this is odd. |
Really odd, managed to reduce to
There is no normal memory access associated so my guess is this is some internal miri memory that the race is detected for, looking into it. |
Reduced to:
It seems to be a data-race in the VTable, are v-tables generated lazily? |
Looked in rustc_mir/src/interpret/traits.rs, i think its that the vtable is generated lazily in thread 1 and then read by thread 2, since they share the same vtable object and hence memory, so we need to somehow disable race detection when vtables are generated. |
Add post-init hook for static memory for miri. Adds a post-initialization hook to treat memory initialized using the interpreter as if it was initialized in a static context. See: rust-lang/miri#1644 & rust-lang/miri#1643
Add post-init hook for static memory for miri. Adds a post-initialization hook to treat memory initialized using the interpreter as if it was initialized in a static context. See: rust-lang/miri#1644 & rust-lang/miri#1643
update Miri update Miri to include fix for rust-lang/miri#1643 Cc `@rust-lang/miri` r? `@ghost`
Hi!
I am excited about the new data race detector, but, unfortunatelly, it fails on once_cell. I think this is a false positive -- I've managed to minimize the test case to do almost literally nothing, and commenting (or uncommenting) a no-op fn is what causes the bug. Here's the repro: matklad/once_cell@93717d9
The test is modified from std: https://github.com/rust-lang/rust/blob/45f638bd8620592b7c50e9b483c2aa8ef9715f5d/library/std/src/sync/once/tests.rs#L17
The text was updated successfully, but these errors were encountered: