[ty] Temporary fix for PropagatedPanic crashes#25463
Closed
MichaReiser wants to merge 1 commit into
Closed
Conversation
PropagatedPanic crashes
MichaReiser
commented
May 29, 2026
| } | ||
|
|
||
| #[cfg(test)] | ||
| pub(crate) mod cancellation_tests { |
Member
Author
There was a problem hiding this comment.
TODO, remove. I only needed these to verify the issue
MichaReiser
commented
May 29, 2026
| /// WARNING: Triggers a new revision, canceling other database handles. This can lead to deadlock. | ||
| pub fn system_mut(&mut self) -> &mut dyn System { | ||
| self.trigger_cancellation(); | ||
| self.synthetic_write(Durability::LOW); |
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 91.94%. The percentage of expected errors that received a diagnostic held steady at 87.09%. The number of fully passing files held steady at 92/134. |
Memory usage reportMemory usage unchanged ✅ |
|
Member
Author
|
This made me realise that the most simplistic fix in salsa isn't much harder than always bumping the revision when a fixpoint query was cancelled. Closing, given that it shouldn't take me much time to land this fix upstream (see salsa-rs/salsa#1100), |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a workaround for #3339 to give me some more time to implement a proper fix in Salsa.
The issue is that the fixpoint computation incorrectly assumes that the only reason a fixpoint query can panic is a bug in the implementation. In which case it doesn't make sense to re-run the query within the same revision because it is only going to panic again (we don't re-run the query in the same revision because there are stale values from the previous revision that Salsa might end up picking up as fresh values). However, that's not the case. The query can also panic if the execution gets cancelled because another thread tries to write (tries to acquire a mut db).
This PR works around this limitation by changing all code paths in ty where we acquire a &mut Db without bumping the revision so that we bump the revision instead. This has the downside that Salsa has to do a little more work to verify that it's okay to reuse all cached queries (because nothing changed). But this seems clearly better than just crashing (and many users seem to be running into this).