Skip to content

std thread::Thread::unpark test deadlocked when run under miri #145816

@jieyouxu

Description

@jieyouxu

Failed in #145384 (comment)

./x test miri --stage 2 library/std --target aarch64-apple-darwin,i686-pc-windows-msvc -- time:: sync:: thread:: env::
failures:

---- library/std/src/thread/mod.rs - thread::Thread::unpark (line 1494) stdout ----
Test executable failed (exit status: 1).

stdout:
Unpark the thread
Parking thread

stderr:
error: the evaluated program deadlocked
    --> /checkout/library/std/src/sys/pal/unix/sync/condvar.rs:47:73
     |
  47 |         let r = unsafe { libc::pthread_cond_wait(self.raw(), mutex.raw()) };
     |                                                                         ^ this thread got stuck here
     |
     = note: BACKTRACE on thread `unnamed-1`:
     = note: inside `std::sys::pal::unix::sync::condvar::Condvar::wait` at /checkout/library/std/src/sys/pal/unix/sync/condvar.rs:47:73: 47:74
note: inside `std::sys::sync::thread_parking::pthread::Parker::park`
    --> /checkout/library/std/src/sys/sync/thread_parking/pthread.rs:79:13
     |
  79 |             self.cvar().wait(self.lock());
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `std::thread::Thread::park`
    --> /checkout/library/std/src/thread/mod.rs:1472:18
     |
1472 |         unsafe { self.inner.as_ref().parker().park() }
     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `std::thread::park`
    --> /checkout/library/std/src/thread/mod.rs:1102:9
     |
1102 |         current().park();
     |         ^^^^^^^^^^^^^^^^
note: inside closure
    --> library/std/src/thread/mod.rs:1501:9
     |
  10 |         thread::park();
     |         ^^^^^^^^^^^^^^

error: the evaluated program deadlocked
    --> /checkout/library/std/src/sys/pal/unix/thread.rs:393:66
     |
 393 |         let ret = unsafe { libc::pthread_join(id, ptr::null_mut()) };
     |                                                                  ^ this thread got stuck here
     |
     = note: BACKTRACE:
     = note: inside `std::sys::pal::unix::thread::Thread::join` at /checkout/library/std/src/sys/pal/unix/thread.rs:393:66: 393:67
note: inside `std::thread::JoinInner::<'_, ()>::join`
    --> /checkout/library/std/src/thread/mod.rs:1769:9
     |
1769 |         self.native.join();
     |         ^^^^^^^^^^^^^^^^^^
note: inside `std::thread::JoinHandle::<()>::join`
    --> /checkout/library/std/src/thread/mod.rs:1924:9
     |
1924 |         self.0.join()
     |         ^^^^^^^^^^^^^
note: inside `main::_doctest_main_library_std_src_thread_mod_rs_1494_0`
    --> library/std/src/thread/mod.rs:1512:1
     |
  21 | parked_thread.join().unwrap();
     | ^^^^^^^^^^^^^^^^^^^^
note: inside `main`
    --> library/std/src/thread/mod.rs:1513:3
     |
  22 | } _doctest_main_library_std_src_thread_mod_rs_1494_0() }
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())`
    --> /checkout/library/core/src/ops/function.rs:253:5
     |
 253 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 2 previous errors




failures:
    library/std/src/thread/mod.rs - thread::Thread::unpark (line 1494)

test result: FAILED. 235 passed; 1 failed; 2 ignored; 0 measured; 1093 filtered out; finished in 39.81s

all doctests ran in 39.94s; merged doctests compilation took 0.08s
error: doctest failed, to rerun pass `-p std --doc`
Bootstrap failed while executing `miri --stage 2 library/std --target aarch64-apple-darwin,i686-pc-windows-msvc -- time:: sync:: thread:: env::`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-miriArea: The miri toolA-testsuiteArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions