Skip to content
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

Recover when attempting to force a query with unknown DefPathHash. #91741

Closed
wants to merge 1 commit into from

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Dec 10, 2021

Fixes #90682
Fixes #90697
Fixes #90715
Fixes #90739
Fixes #91401

In the bugs above, the dep-graph attempts to force a dep-node whose DefPathHash is not known to the compiler. This causes an ICE because the query that refers to this DefPathHash should have been marked red.

This PR hides the bug by gracefully failing to force the query when this happens. I think this is the wrong solution to the problem. However, this has the merit of avoiding user-visible ICEs.

The right solution would be to find where the alien DefPathHash come from and to plug the information leak. I believe #85914 it responsible for a part.

r? @michaelwoerister

@cjgillot
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 10, 2021
@bors
Copy link
Contributor

bors commented Dec 10, 2021

⌛ Trying commit 732dd13 with merge 7d7dd539439c1a9bcfe84fecb020cae61a1c2561...

@bors
Copy link
Contributor

bors commented Dec 11, 2021

☀️ Try build successful - checks-actions
Build commit: 7d7dd539439c1a9bcfe84fecb020cae61a1c2561 (7d7dd539439c1a9bcfe84fecb020cae61a1c2561)

@rust-timer
Copy link
Collaborator

Queued 7d7dd539439c1a9bcfe84fecb020cae61a1c2561 with parent 0b42dea, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7d7dd539439c1a9bcfe84fecb020cae61a1c2561): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 11, 2021
@ibraheemdev
Copy link
Member

I believe this also fixes #91705, #91696, #91662, #91595, #91511, #90594, #90682, #89361, #89962, #45439, #90594, #89260, #89539, #91595.. and probably some others 😅

@camelid camelid added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 13, 2021
@michaelwoerister
Copy link
Member

Thanks a lot for PR and the investigation, @cjgillot!
I'll try to review and think through the problem as soon as possible. I know we had these methods return Option<DefId> instead of DefId in the past.

@cjgillot
Copy link
Contributor Author

@Aaron1011 does this PR fix the issue you diagnosed in #91696 (comment)? Or is the ice simply moved somewhere else?

Should we prefer wrapping try_load_from_on_disk_cache_in_memory in dep_graph.with_ignore?

@Aaron1011
Copy link
Member

@cjgillot: Personally, I think silently suppressing this error is the wrong thing to do. Fixing the issue identified in #91696 (comment) should fix most of the cases of this - any remaining crashes will be a new issue which we'll want to be alerted of.

Should we prefer wrapping try_load_from_on_disk_cache_in_memory in dep_graph.with_ignore?

I think that would work, but I would prefer to avoid creating any new dep graph edges during the loading of queries.

@michaelwoerister
Copy link
Member

OK, so the conclusion here is that we should rather fix the (now identified) underlying issue, that is, that queries invoked during cache loading are not handled correctly, right?

@BGR360 BGR360 mentioned this pull request Dec 21, 2021
@cjgillot cjgillot closed this Jan 15, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 24, 2023
Print a backtrace when query forcing fails.

The aim of this PR is to help debugging incremental compilation bugs where query forcing panics.
For instance: rust-lang#90682 rust-lang#90697 rust-lang#90715 rust-lang#90739 rust-lang#91401

These bugs happen when the dep-graph attempts to force a dep-node whose fingerprint does not correspond to an actual DefPathHash. PR rust-lang#91741 attempts to hide this bug.

I still don't know how to reproduce these bugs, so I sadly could not test this debugging device.
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Feb 26, 2023
Print a backtrace when query forcing fails.

The aim of this PR is to help debugging incremental compilation bugs where query forcing panics.
For instance: rust-lang/rust#90682 rust-lang/rust#90697 rust-lang/rust#90715 rust-lang/rust#90739 rust-lang/rust#91401

These bugs happen when the dep-graph attempts to force a dep-node whose fingerprint does not correspond to an actual DefPathHash. PR rust-lang/rust#91741 attempts to hide this bug.

I still don't know how to reproduce these bugs, so I sadly could not test this debugging device.
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 20, 2024
Print a backtrace when query forcing fails.

The aim of this PR is to help debugging incremental compilation bugs where query forcing panics.
For instance: rust-lang/rust#90682 rust-lang/rust#90697 rust-lang/rust#90715 rust-lang/rust#90739 rust-lang/rust#91401

These bugs happen when the dep-graph attempts to force a dep-node whose fingerprint does not correspond to an actual DefPathHash. PR rust-lang/rust#91741 attempts to hide this bug.

I still don't know how to reproduce these bugs, so I sadly could not test this debugging device.
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
Print a backtrace when query forcing fails.

The aim of this PR is to help debugging incremental compilation bugs where query forcing panics.
For instance: rust-lang/rust#90682 rust-lang/rust#90697 rust-lang/rust#90715 rust-lang/rust#90739 rust-lang/rust#91401

These bugs happen when the dep-graph attempts to force a dep-node whose fingerprint does not correspond to an actual DefPathHash. PR rust-lang/rust#91741 attempts to hide this bug.

I still don't know how to reproduce these bugs, so I sadly could not test this debugging device.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
8 participants