Skip to content

can't call foreign function: InitOnceBeginInitialize when running on Windows #2595

Closed
@V0ldek

Description

@V0ldek

My crate aligners got a failure in a scheduled Miri pipeline (job) absent any changes to the crate's code on the nightly version available in the night between 13th and 14th of October.

Three of the pipeline targets seem to be failing:

  • x86_64-pc-windows-gnu
  • i686-pc-windows-gnu
  • i686-pc-windows-msvc

Surprisingly, x86_64-pc-windows-msvc seems to be working.

Here's the full error:

error: unsupported operation: can't call foreign function: InitOnceBeginInitialize
Error:   --> C:\Users\runneradmin\.rustup\toolchains\nightly-x86_[64](https://github.com/V0ldek/aligners/actions/runs/3246804722/jobs/5333903357#step:4:65)-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\windows\thread_local_key.rs:88:21
   |
88 |             let r = c::InitOnceBeginInitialize(self.once.get(), 0, &mut pending, ptr::null_mut());
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: InitOnceBeginInitialize
   |
   = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
   = note: BACKTRACE:
   = note: inside `std::sys::windows::thread_local_key::StaticKey::init` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\windows\thread_local_key.rs:88:21
   = note: inside `std::sys::windows::thread_local_key::StaticKey::key` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\windows\thread_local_key.rs:79:18
   = note: inside `std::sys::windows::thread_local_key::StaticKey::get` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\windows\thread_local_key.rs:73:24
   = note: inside `std::thread::__OsLocalKeyInner::<std::cell::RefCell<std::option::Option<std::sys_common::thread_info::ThreadInfo>>>::get::<[closure@std::sys_common::thread_info::THREAD_INFO::__getit::{closure#0}]>` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\local.rs:1080:32
   = note: inside `std::sys_common::thread_info::THREAD_INFO::__getit` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\local.rs:271:21
   = note: inside `std::thread::LocalKey::<std::cell::RefCell<std::option::Option<std::sys_common::thread_info::ThreadInfo>>>::try_with::<[closure@std::sys_common::thread_info::set::{closure#0}], ()>` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\local.rs:445:32
   = note: inside `std::thread::LocalKey::<std::cell::RefCell<std::option::Option<std::sys_common::thread_info::ThreadInfo>>>::with::<[closure@std::sys_common::thread_info::set::{closure#0}], ()>` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\local.rs:422:9
   = note: inside `std::sys_common::thread_info::set` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys_common\thread_info.rs:42:5
   = note: inside `std::rt::init` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\rt.rs:105:9
   = note: inside closure at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\rt.rs:147:42
   = note: inside `std::panicking::r#try::do_call::<[closure@std::rt::lang_start_internal::{closure#1}], ()>` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:483:40
   = note: inside `std::panicking::r#try::<(), [closure@std::rt::lang_start_internal::{closure#1}]>` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:447:19
   = note: inside `std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#1}], ()>` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panic.rs:137:14
   = note: inside `std::rt::lang_start_internal` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\rt.rs:147:5
   = note: inside `std::rt::lang_start::<()>` at C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\rt.rs:1[65](https://github.com/V0ldek/aligners/actions/runs/3246804722/jobs/5333903357#step:4:66):17

There's none of my code in this trace. The tests failing are here, but they don't seem to be even running when this fails. Rerunning the actions causes the same result, so it doesn't look like a transient error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-windowsArea: affects only Windows targetsC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions