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

rustc panic while reading incremental index #48847

Closed
jsgf opened this issue Mar 8, 2018 · 0 comments
Closed

rustc panic while reading incremental index #48847

jsgf opened this issue Mar 8, 2018 · 0 comments
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ WG-incr-comp Working group: Incremental compilation

Comments

@jsgf
Copy link
Contributor

jsgf commented Mar 8, 2018

rustc crashed during compilation with:

$ buck test scm/mononoke/tests/integration                                                                                                             
error: could not load dep-graph from `buck-out/tmp/rust-incremental/bundle2_resolver-2xb5l9oneofqa/s-eyz77d7pz2-4k21tt-working/dep-graph.bin`: failed to fill whole buffer


thread '<unnamed>' panicked at 'index out of bounds: the len is 4194304 but the index is 4194304', rust/1.24.0/src/rust/src/libserialize/leb128.rs:59:20
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.24.0-dev running on x86_64-unknown-linux-gnu

thread 'rustc' panicked at 'Could not join with background dep_graph thread: Any', rust/src/libcore/result.rs:916:5

(This is a locally built rustc 1.24.0, compiled in the dev channel. It is being invoked from Buck in a custom build system, which is why the paths are atypical.)

It appears that the file is truncated, or corrupt in some way that makes it try to parse off the end of the file. This was on a machine that had been running into out-of-memory conditions, so its possible its a left-over from a previous failed compilation attempt.

I think rustc should handle corrupted incremental data by handling the error, deleting the file and compiling non-incrementally.

@Centril Centril added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. WG-incr-comp Working group: Incremental compilation labels Mar 8, 2018
wesleywiser added a commit to wesleywiser/rust that referenced this issue Mar 28, 2018
If the cached data can't be loaded from disk, just issue a warning to
the user so they know why compilation is taking longer than usual but
don't fail the entire compilation since we can recover by ignorning the
on disk cache.

In the same way, if the disk cache can't be deserialized (because it has
been corrupted for some reason), report the issue as a warning and
continue without failing the compilation. `Decodable::decode()` tends to
panic with various errors like "entered unreachable code" or "index out
of range" if the input data is corrupted. Work around this by catching
panics from the `decode()` calls when joining the thread and continuing
without the cached data.

Fixes rust-lang#48847
kennytm added a commit to kennytm/rust that referenced this issue Mar 28, 2018
…e, r=michaelwoerister

[incremental] Don't panic if decoding the cache fails

If the cached data can't be loaded from disk, just issue a warning to
the user so they know why compilation is taking longer than usual but
don't fail the entire compilation since we can recover by ignorning the
on disk cache.

In the same way, if the disk cache can't be deserialized (because it has
been corrupted for some reason), report the issue as a warning and
continue without failing the compilation. `Decodable::decode()` tends to
panic with various errors like "entered unreachable code" or "index out
of range" if the input data is corrupted. Work around this by catching
panics from the `decode()` calls and continuing without the cached data.

Fixes rust-lang#48847
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ WG-incr-comp Working group: Incremental compilation
Projects
None yet
Development

No branches or pull requests

2 participants