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

incr.comp.: index out of bounds crashes #49065

Closed
jjl opened this issue Mar 15, 2018 · 12 comments
Closed

incr.comp.: index out of bounds crashes #49065

jjl opened this issue Mar 15, 2018 · 12 comments
Assignees
Labels
A-incr-comp Area: Incremental compilation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jjl
Copy link

jjl commented Mar 15, 2018

Not sure how useful this is, since I just updated nightly and it stopped happening, but I'll let you judge...

Running cargo build on my project, I get this (once RUST_BACKTRACE=full is set):

thread 'rustc' panicked at 'index out of bounds: the len is 137459 but the index is 137460', /checkout/src/libcore/slice/mod.rs:865:10
stack backtrace:
   0:     0x7f86664d8f03 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hd7f509eb95e8bc27
                               at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7f86664cfde4 - std::sys_common::backtrace::_print::hb1b9da2d2a3862cc
                               at libstd/sys_common/backtrace.rs:71
   2:     0x7f86664d57ad - std::panicking::default_hook::{{closure}}::hcc596a1e59233c7a
                               at libstd/sys_common/backtrace.rs:59
                               at libstd/panicking.rs:207
   3:     0x7f86664d54a9 - std::panicking::default_hook::h99aade27d2e716f2
                               at libstd/panicking.rs:223
   4:     0x7f8662f62add - core::ops::function::Fn::call::he53493e358b9988d
   5:     0x7f86664d5c49 - std::panicking::rust_panic_with_hook::hbbeee10ff096b203
                               at libstd/panicking.rs:403
   6:     0x7f86664d5a32 - std::panicking::begin_panic_fmt::h1c0d1191acdd1812
                               at libstd/panicking.rs:349
   7:     0x7f86664d5962 - rust_begin_unwind
                               at libstd/panicking.rs:325
   8:     0x7f866653af70 - core::panicking::panic_fmt::hacb4853db78127fc
                               at libcore/panicking.rs:72
   9:     0x7f866653af13 - core::panicking::panic_bounds_check::hebc2529c554325e2
                               at libcore/panicking.rs:58
  10:     0x7f8663112d9f - rustc::dep_graph::graph::DepGraph::try_mark_green::h058a3f91e7619a70
  11:     0x7f865b8f3297 - rustc_trans::base::trans_crate::h0324d5b350db1bea
  12:     0x7f865b94fed7 - <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate::h0e5d8abb384c1b70
  13:     0x7f8666898e42 - rustc_driver::driver::phase_4_translate_to_llvm::h84b82bdc7bdd5495
  14:     0x7f8666891bde - rustc_driver::driver::compile_input::{{closure}}::he8485d73a132d58f
  15:     0x7f866682c104 - rustc::ty::context::TyCtxt::create_and_enter::hca90d38d454dfbc9
  16:     0x7f866688fc0e - rustc_driver::driver::compile_input::hbdffce9807544715
  17:     0x7f86668ac7ea - rustc_driver::run_compiler::hfc6fd0dfc92b85aa
  18:     0x7f86667d7a70 - std::sys_common::backtrace::__rust_begin_short_backtrace::h2bc6706ec1048bfe
  19:     0x7f86664eeaee - __rust_maybe_catch_panic
                               at libpanic_unwind/lib.rs:102
  20:     0x7f86668110c6 - <F as alloc::boxed::FnBox<A>>::call_box::hf1650b92215a5e7a
  21:     0x7f86664e5d9b - std::sys::unix::thread::Thread::new::thread_start::h8e74ba576ba4f1cf
                               at /checkout/src/liballoc/boxed.rs:793
                               at libstd/sys_common/thread.rs:24
                               at libstd/sys/unix/thread.rs:90
  22:     0x7f86613da493 - start_thread
  23:     0x7f86661afafe - __clone
  24:                0x0 - <unknown>

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.26.0-nightly (2789b067d 2018-03-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `myci`.

Caused by:
  process didn't exit successfully: `rustc --crate-name myci src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=8e20208795e39136 -C extra-filename=-8e20208795e39136 --out-dir /home/james/code/myci/myci_rs/target/debug/deps -C incremental=/home/james/code/myci/myci_rs/target/debug/incremental -L dependency=/home/james/code/myci/myci_rs/target/debug/deps --extern base64=/home/james/code/myci/myci_rs/target/debug/deps/libbase64-798ec0590fabe7c9.rlib --extern diesel=/home/james/code/myci/myci_rs/target/debug/deps/libdiesel-906a957d01efc9a8.rlib --extern chrono=/home/james/code/myci/myci_rs/target/debug/deps/libchrono-71717a2c50fa509e.rlib --extern ring=/home/james/code/myci/myci_rs/target/debug/deps/libring-40f8f3688a4c7dde.rlib --extern futures=/home/james/code/myci/myci_rs/target/debug/deps/libfutures-e5b96ca099608c30.rlib --extern dotenv=/home/james/code/myci/myci_rs/target/debug/deps/libdotenv-c94dbb2ea9f1a23e.rlib --extern websocket=/home/james/code/myci/myci_rs/target/debug/deps/libwebsocket-391e7dbfddf8286f.rlib --extern r2d2=/home/james/code/myci/myci_rs/target/debug/deps/libr2d2-72586ac1063d346b.rlib --extern unshare=/home/james/code/myci/myci_rs/target/debug/deps/libunshare-4898551b815c32fd.rlib --extern hyper=/home/james/code/myci/myci_rs/target/debug/deps/libhyper-3a6aad3091271e51.rlib --extern uuid=/home/james/code/myci/myci_rs/target/debug/deps/libuuid-cf4be5b1877c8818.rlib --extern libmount=/home/james/code/myci/myci_rs/target/debug/deps/liblibmount-a0822e5934db28e8.rlib -L native=/usr/lib/x86_64-linux-gnu -L native=/home/james/code/myci/myci_rs/target/debug/build/backtrace-sys-95d5acac02bbebb5/out/.libs -L native=/home/james/code/myci/myci_rs/target/debug/build/ring-3841c8ecebbcebd0/out` (exit code: 101)

@estebank estebank added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 15, 2018
@jjl
Copy link
Author

jjl commented Mar 15, 2018

Similar-looking crash on mildly tweaked code under latest nightly:

thread 'rustc' panicked at 'index out of bounds: the len is 146464 but the index is 146464', /checkout/src/libcore/slice/mod.rs:871:14
stack backtrace:
   0:     0x7fba14b799a3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h6b1aa521439b5a8f
                               at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7fba14b70854 - std::sys_common::backtrace::_print::hf0c55570aef1b27d
                               at libstd/sys_common/backtrace.rs:71
   2:     0x7fba14b7623d - std::panicking::default_hook::{{closure}}::h488bb196ba72cdaa
                               at libstd/sys_common/backtrace.rs:59
                               at libstd/panicking.rs:207
   3:     0x7fba14b75f39 - std::panicking::default_hook::hef52c65948961f87
                               at libstd/panicking.rs:223
   4:     0x7fba115e5f8d - core::ops::function::Fn::call::h7157cbafb9ba04dd
   5:     0x7fba14b766d9 - std::panicking::rust_panic_with_hook::h8de03ed35cb0aca6
                               at libstd/panicking.rs:403
   6:     0x7fba14b764c2 - std::panicking::begin_panic_fmt::he59de9a058877729
                               at libstd/panicking.rs:349
   7:     0x7fba14b763f2 - rust_begin_unwind
                               at libstd/panicking.rs:325
   8:     0x7fba14bdbcb0 - core::panicking::panic_fmt::hcf48133a163446a9
                               at libcore/panicking.rs:72
   9:     0x7fba14bdbc53 - core::panicking::panic_bounds_check::had8878732a61d7c7
                               at libcore/panicking.rs:58
  10:     0x7fba1177bb46 - rustc::dep_graph::graph::DepGraph::with_task_impl::h69ea33b1a83370f9
  11:     0x7fba11b03486 - rustc::ty::maps::<impl rustc::ty::maps::queries::crate_disambiguator<'tcx>>::force::h4a442cc6872941ce
  12:     0x7fba11b04409 - rustc::ty::maps::<impl rustc::ty::maps::queries::crate_disambiguator<'tcx>>::try_get::h2e50dfe8a458fb39
  13:     0x7fba11b7d7e5 - rustc::ty::maps::TyCtxtAt::crate_disambiguator::hb8db33de2220679d
  14:     0x7fba11980911 - rustc::ty::maps::on_disk_cache::OnDiskCache::compute_cnum_map::{{closure}}::{{closure}}::h36dadc8e90e8c0c2
  15:     0x7fba115c4c63 - <std::collections::hash::map::HashMap<K, V, S> as core::iter::traits::Extend<(K, V)>>::extend::h44090189c5bea819
  16:     0x7fba1175f6b2 - rustc::dep_graph::graph::DepGraph::with_ignore::h204ae534ae08069c
  17:     0x7fba1197c624 - rustc::ty::maps::on_disk_cache::OnDiskCache::load_diagnostics::h87d8c2c7cdf16d7e
  18:     0x7fba1179ae41 - rustc::dep_graph::graph::DepGraph::try_mark_green::h6adb32782295b92c
  19:     0x7fba11962a88 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_mark_green_and_read::h9dd24a0a495e64bf
  20:     0x7fba11aa5763 - rustc::ty::maps::<impl rustc::ty::maps::queries::trans_fn_attrs<'tcx>>::try_get::h73a16b44c41157cd
  21:     0x7fba11b7b6cb - rustc::ty::maps::TyCtxtAt::trans_fn_attrs::hc9a60d17a8556b94
  22:     0x7fba1179f8fa - <rustc::hir::check_attr::CheckAttrVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item::h537d59fb9e638edf
  23:     0x7fba117a1907 - rustc::hir::check_attr::check_crate::h9223c79ba3d97259
  24:     0x7fba14ed35bb - rustc::ty::context::TyCtxt::create_and_enter::hb54e14a06694259e
  25:     0x7fba14f38321 - rustc_driver::driver::compile_input::h6560736e056a863b
  26:     0x7fba14f55435 - rustc_driver::run_compiler::h060b34b2732dceee
  27:     0x7fba14e7e200 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd18945a624b32a6b
  28:     0x7fba14b8f53e - __rust_maybe_catch_panic
                               at libpanic_unwind/lib.rs:102
  29:     0x7fba14eb91d6 - <F as alloc::boxed::FnBox<A>>::call_box::h75b5bcc306bf3f92
  30:     0x7fba14b8679b - std::sys::unix::thread::Thread::new::thread_start::h3d29264a23eaa0fc
                               at /checkout/src/liballoc/boxed.rs:793
                               at libstd/sys_common/thread.rs:24
                               at libstd/sys/unix/thread.rs:90
  31:     0x7fba0fa61493 - start_thread
  32:     0x7fba1484fafe - __clone
  33:                0x0 - <unknown>

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.26.0-nightly (521d91c6b 2018-03-14) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `myci`.

Caused by:
  process didn't exit successfully: `rustc --crate-name myci src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=3b60f9127c64b658 -C extra-filename=-3b60f9127c64b658 --out-dir /home/james/code/myci/myci_rs/target/debug/deps -C incremental=/home/james/code/myci/myci_rs/target/debug/incremental -L dependency=/home/james/code/myci/myci_rs/target/debug/deps --extern uuid=/home/james/code/myci/myci_rs/target/debug/deps/libuuid-812570f1efa45dae.rlib --extern r2d2=/home/james/code/myci/myci_rs/target/debug/deps/libr2d2-b007805a486e80d1.rlib --extern unshare=/home/james/code/myci/myci_rs/target/debug/deps/libunshare-2ae1263adf91031c.rlib --extern futures=/home/james/code/myci/myci_rs/target/debug/deps/libfutures-e25fbc7f0146e954.rlib --extern websocket=/home/james/code/myci/myci_rs/target/debug/deps/libwebsocket-16323a0f8cd6c0ba.rlib --extern hyper=/home/james/code/myci/myci_rs/target/debug/deps/libhyper-c44559d6f78edfb7.rlib --extern chrono=/home/james/code/myci/myci_rs/target/debug/deps/libchrono-59e40df4a6365872.rlib --extern dotenv=/home/james/code/myci/myci_rs/target/debug/deps/libdotenv-3647f4459f633ef0.rlib --extern libmount=/home/james/code/myci/myci_rs/target/debug/deps/liblibmount-62a1ac17e6f4ea2a.rlib --extern base64=/home/james/code/myci/myci_rs/target/debug/deps/libbase64-c91850d8cd9276d4.rlib --extern ring=/home/james/code/myci/myci_rs/target/debug/deps/libring-197552645c135b9e.rlib --extern diesel=/home/james/code/myci/myci_rs/target/debug/deps/libdiesel-20dd4c1711b4fc1b.rlib -L native=/usr/lib/x86_64-linux-gnu -L native=/home/james/code/myci/myci_rs/target/debug/build/backtrace-sys-f7e191858d272cd3/out/.libs -L native=/home/james/code/myci/myci_rs/target/debug/build/ring-55fc3222616ce83e/out` (exit code: 101)

@ExpHP
Copy link
Contributor

ExpHP commented Mar 15, 2018

This could potentially be related to #48923? Not sure; on the surface, the outer bits of this backtrace and the other suggest that the crashes occurred at seemingly very different points in compilation, but the actual panic itself in both cases is very similar (index errors in DepGraph).

When you say it stopped happening, did you only compile it one time, or has it been compiled more than once now without issue? I ask because @avl reported in the other thread that his difficulty was specifically with recompiles:

Ok, now that I've fixed the compilation errors, the program compiles ok with CARGO_INCREMENTAL=0 . It even appears to run correctly, but it still cannot be recompiled with CARGO_INCREMENTAL=1 .

It can be compiled with CARGO_INCREMENTAL=0
It can be compiled once (after "cargo clean"), with CARGO_INCREMENTAL=1
Subsequent compiles with CARGO_INCREMENTAL=1 crash, even after a whitespace-only change.

@jjl
Copy link
Author

jjl commented Mar 15, 2018

So I've been developing this code for a few days and it stopped compiling just this evening when I filed this bug.

Upgrading to latest nightly stopped the error, but I've made a few changes and now it's broken again with a slightly different but broadly similar stacktrace.

@jjl
Copy link
Author

jjl commented Mar 15, 2018

I've just read the linked bug and yes, sounds very similar. I'm using diesel, which is all macro magic.

@ExpHP
Copy link
Contributor

ExpHP commented Mar 15, 2018

Yeah, I just missed your post before responding. Can you try deleting the incremental cache and/or compiling with CARGO_INCREMENTAL=0 to see if the details line up with that issue?

@jjl
Copy link
Author

jjl commented Mar 15, 2018

If I run with CARGO_INCREMENTAL=0, indeed it seems to go away. my code doesn't compile, but rust didn't crash.

@michaelwoerister
Copy link
Member

Looks like a bug in incremental compilation. Thanks for the bug report!

@michaelwoerister michaelwoerister added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-incr-comp Area: Incremental compilation labels Mar 16, 2018
@michaelwoerister michaelwoerister changed the title crash compiling incr.comp.: index out of bounds crashes Mar 16, 2018
@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added the P-high High priority label Mar 16, 2018
@nikomatsakis
Copy link
Contributor

Likely a dup of #48923

@RandomInsano
Copy link
Contributor

RandomInsano commented Mar 17, 2018

I've hit an issue apparently in the cc crate (version 1.0.8) that I can't get around by disabling incremental compilation. I posted the results in #48923 but can create a new issue if that's the right course of action. I can also provide the sample code if needed.

@michaelwoerister
Copy link
Member

@RandomInsano, thanks for the report. This looks indeed like a different problem. I would be great if you could open a separate issue for it.

@michaelwoerister
Copy link
Member

I'm closing this as a duplicate of #48923.

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 I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants