-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Remove double check when decoding ExpnId to avoid races #148306
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
Conversation
|
r? @nnethercote rustbot has assigned @nnethercote. Use |
|
cc @cjgillot |
I'm surprised you're seeing a debug assertion failure. Did you build your own compiler? As for the fix, it seems plausible, but I'm not familiar with this code. @Zoxc or @Mark-Simulacrum, can you evaluate this change? |
Yes, I did. I am trying to solve #141540, it is the most active I usually keep |
|
Ok, seems reasonable. @bors r+ rollup |
|
It indeed looks like |
Rollup of 8 pull requests Successful merges: - #135099 (Add FileCheck annotations to mir-opt/copy-prop) - #145903 (Give correct suggestion for a typo in raw pointers) - #147520 (Port the remaining SIMD intrinsics to const-eval) - #148068 (rustdoc: Use configured target modifiers when collecting doctests) - #148099 (Prepare to move debugger discovery from compiletest to bootstrap) - #148268 (rustdoc: fix `--emit=dep-info` on scraped examples) - #148306 (Remove double check when decoding ExpnId to avoid races) - #148378 (Fix documentation for std::panic::update_hook) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #148306 - zetanumbers:expn_id_decode, r=nnethercote Remove double check when decoding ExpnId to avoid races Fixes debug assertion failure as described in #141540 (comment) Essentially failure happens during the race while decoding one `ExpnId` from different threads. This ICE doesn't happen with single threaded thread_pool due to early return within `decode_expn_id` with the same condition: https://github.com/rust-lang/rust/blob/8205e6b75ec656305ac235d4726d2c7a1ddcef14/compiler/rustc_middle/src/query/on_disk_cache.rs#L605-L607 However I believe this race does not hurt because `register_expn_id` is pretty much idempotent: https://github.com/rust-lang/rust/blob/8205e6b75ec656305ac235d4726d2c7a1ddcef14/compiler/rustc_span/src/hygiene.rs#L1397-L1413
Rollup of 8 pull requests Successful merges: - rust-lang/rust#135099 (Add FileCheck annotations to mir-opt/copy-prop) - rust-lang/rust#145903 (Give correct suggestion for a typo in raw pointers) - rust-lang/rust#147520 (Port the remaining SIMD intrinsics to const-eval) - rust-lang/rust#148068 (rustdoc: Use configured target modifiers when collecting doctests) - rust-lang/rust#148099 (Prepare to move debugger discovery from compiletest to bootstrap) - rust-lang/rust#148268 (rustdoc: fix `--emit=dep-info` on scraped examples) - rust-lang/rust#148306 (Remove double check when decoding ExpnId to avoid races) - rust-lang/rust#148378 (Fix documentation for std::panic::update_hook) r? `@ghost` `@rustbot` modify labels: rollup
Fixes debug assertion failure as described in #141540 (comment)
Essentially failure happens during the race while decoding one
ExpnIdfrom different threads. This ICE doesn't happen with single threaded thread_pool due to early return withindecode_expn_idwith the same condition:rust/compiler/rustc_middle/src/query/on_disk_cache.rs
Lines 605 to 607 in 8205e6b
However I believe this race does not hurt because
register_expn_idis pretty much idempotent:rust/compiler/rustc_span/src/hygiene.rs
Lines 1397 to 1413 in 8205e6b