Skip to content

Latest nightly rustc deadlocks/hangs indefinitely when trying to compile otherwise correct code (nightly-x86_64-unknown-linux-gnu 9fae15374 2018-05-13) #50755

Closed
@ghost

Description

I apologize in advance as neither I nor the fine folks on #rust IRC were able to reduce this problem down to something manageable, so I leave a full repository (granted, not a terrible large amount of code) and just a few hints of what I know.

See here for the offending code.

No matter how I invoke rustc (cargo build, cargo rustc, cargo build -v -j 1, etc.), it deadlocks some time after checking for correctness (typeck/borrowck) and emitting warnings. Originally I thought this was an RLS bug as it made RLS hang indefinitely, but after leaving rustc running for upwards of 8 hours, it refuses to complete compilation.

It started when writing this line, when I initially solved the type error I had there by casting offshoot (a u64) to a usize. That could be a red herring, I don't know.

I tried running cargo build -v under gdb, and this is the relevant where results that I got after suspending execution from within the deadlock, if it's any help:

warning: unused variable: `padding_buf`
    --> src/state.rs:1014:17
     |
1014 |             let padding_buf = [0u8; 7];
     |                 ^^^^^^^^^^^ help: consider using `_padding_buf` instead
     |
     = note: #[warn(unused_variables)] on by default
 
warning: unused variable: `bitmap_data_offset`
    --> src/state.rs:1034:13
     |
1034 |         let mut bitmap_data_offset = offset + 8 * bitmaps.len() as u64;
     |             ^^^^^^^^^^^^^^^^^^^^^^ help: consider using `_bitmap_data_offset` instead
 
^C
Thread 1 "cargo" received signal SIGINT, Interrupt.
0x00007ffff77baffc in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
(gdb) where
#0  0x00007ffff77baffc in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x0000555555d105c7 in std::sys::unix::condvar::Condvar::wait () at libstd/sys/unix/condvar.rs:78
#2  std::sys_common::condvar::Condvar::wait () at libstd/sys_common/condvar.rs:51
#3  std::sync::condvar::Condvar::wait () at libstd/sync/condvar.rs:214
#4  std::thread::park () at libstd/thread/mod.rs:803
#5  0x0000555555d1a0d1 in std::sync::mpsc::blocking::WaitToken::wait () at libstd/sync/mpsc/blocking.rs:81
#6  0x00005555556aa2db in <std::sync::mpsc::shared::Packet<T>>::recv ()
#7  0x0000555555655b9b in <std::sync::mpsc::Receiver<T>>::recv ()
#8  0x0000555555774152 in cargo::core::compiler::job_queue::JobQueue::drain_the_queue ()
#9  0x00005555556e3867 in crossbeam::scoped::scope ()
#10 0x000055555576c3e1 in cargo::core::compiler::context::Context::compile ()
#11 0x00005555556bda59 in cargo::ops::cargo_compile::compile_ws ()
#12 0x00005555556ba3b6 in cargo::ops::cargo_compile::compile_with_exec ()
#13 0x0000555555715aaf in cargo::ops::cargo_run::run ()
#14 0x00005555555f18de in cargo::commands::run::exec ()
#15 0x00005555555eb0dc in cargo::cli::main ()
#16 0x00005555555e1f44 in cargo::main ()
#17 0x0000555555606613 in std::rt::lang_start::{{closure}} ()
#18 0x0000555555cfd6a3 in std::rt::lang_start_internal::{{closure}} () at libstd/rt.rs:59
#19 std::panicking::try::do_call () at libstd/panicking.rs:310
#20 0x0000555555d28daa in __rust_maybe_catch_panic () at libpanic_unwind/lib.rs:105
#21 0x0000555555d0a106 in std::panicking::try () at libstd/panicking.rs:289
#22 std::panic::catch_unwind () at libstd/panic.rs:374
#23 std::rt::lang_start_internal () at libstd/rt.rs:58
#24 0x00005555555e4164 in main ()
(gdb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-compiletimeIssue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions