-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix waiting on a query that panicked #115198
Conversation
// We didn't find the query result in the query cache. Check if it was | ||
// poisoned due to a panic instead. | ||
let lock = query.query_state(qcx).active.get_shard_by_value(&key).lock(); | ||
match lock.get(&key) { | ||
// The query we waited on panicked. Continue unwinding here. | ||
Some(QueryResult::Poisoned) => FatalError.raise(), | ||
_ => panic!( | ||
"query result must in the cache or the query must be poisoned after a wait" | ||
), | ||
} |
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.
The only possible course of action is unwinding. Should we replace the match by an assertion?
// We didn't find the query result in the query cache. Check if it was | |
// poisoned due to a panic instead. | |
let lock = query.query_state(qcx).active.get_shard_by_value(&key).lock(); | |
match lock.get(&key) { | |
// The query we waited on panicked. Continue unwinding here. | |
Some(QueryResult::Poisoned) => FatalError.raise(), | |
_ => panic!( | |
"query result must in the cache or the query must be poisoned after a wait" | |
), | |
} | |
// We didn't find the query result in the query cache. Check if it was | |
// poisoned due to a panic instead. | |
debug_assert!( | |
matches!( | |
query.query_state(qcx).active.get_shard_by_value(&key).lock().get(&key), | |
Some(QueryResult::Poisoned), | |
), | |
"query result must in the cache or the query must be poisoned after a wait", | |
); | |
// The query we waited on panicked. Continue unwinding here. | |
FatalError.raise() |
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.
I feel like the current version makes it more clear that we should only call FatalError.raise()
once we observe the QueryResult::Poisoned
case. I don't think I want to downgrade to a debug_assert
without some more testing of the parallel compiler. This path is also not terribly hot.
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (22d41ae): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 630.77s -> 631.198s (0.07%) |
This fixes waiting on a query that panicked. The code now looks for
QueryResult::Poisoned
in the query state in addition to the query cache. This fixes #111528.r? @cjgillot