OpenDevicePartnership / OpenDevicePartnership/patina
[Bug]: Occasional panic in allocator unit tests (Re-entrant locks for "GcdMemLock" not permitted)
Open
@kouchekiniad is already working on this.
Since Sep 22, 2025.
state:needs-triage
type:bug
urgency:low
- Dominant language
- Rust
- Stars
- 544
- Forks
- 54
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 30
Description
Is there an existing issue for this?
- I have searched existing issues
Current Behavior
Occasionally seeing this in CI (even when not Rust source files are modified):
. . .
test tpl_lock::tests::tpl_mutex_should_change_tpl_if_bs_available ... ok
failures:
---- allocator::tests::init_memory_support_should_process_resource_allocations stdout ----
thread 'allocator::tests::init_memory_support_should_process_resource_allocations' panicked at patina_dxe_core\src\tpl_lock.rs:74:43:
Re-entrant locks for "GcdMemLock" not permitted.
stack backtrace:
0: 0x7ff716a8d112 - std::backtrace_rs::backtrace::win64::trace
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
1: 0x7ff716a8d112 - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7ff716a8d112 - std::sys::backtrace::_print_fmt
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\sys\backtrace.rs:66
3: 0x7ff716a8d112 - std::sys::backtrace::impl$0::print::impl$0::fmt
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\sys\backtrace.rs:39
4: 0x7ff716aa97bb - core::fmt::rt::Argument::fmt
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\core\src\fmt\rt.rs:173
5: 0x7ff716aa97bb - core::fmt::write
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\core\src\fmt\mod.rs:1465
6: 0x7ff716a89437 - std::io::default_write_fmt
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\io\mod.rs:639
7: 0x7ff716a89437 - std::io::Write::write_fmt<alloc::vec::Vec<u8,alloc::alloc::Global> >
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\io\mod.rs:1954
8: 0x7ff716a8cf55 - std::sys::backtrace::BacktraceLock::print
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\sys\backtrace.rs:42
9: 0x7ff716a908da - std::panicking::default_hook::closure$0
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\panicking.rs:300
10: 0x7ff716a906cb - std::panicking::default_hook
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\panicking.rs:324
11: 0x7ff71695f462 - alloc::boxed::impl$30::call
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\alloc\src\boxed.rs:1980
12: 0x7ff71695f462 - test::test_main_with_exit_callback::closure$0<test::test_main::closure_env$0>
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\test\src\lib.rs:145
13: 0x7ff716a914bc - std::panicking::rust_panic_with_hook
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\panicking.rs:841
14: 0x7ff716a91229 - std::panicking::begin_panic_handler::closure$0
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\panicking.rs:706
15: 0x7ff716a8decf - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\sys\backtrace.rs:168
16: 0x7ff716a90e3e - std::panicking::begin_panic_handler
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\panicking.rs:697
17: 0x7ff716ab2d81 - core::panicking::panic_fmt
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\core\src\panicking.rs:75
18: 0x7ff71687c7bb - patina_dxe_core::tpl_lock::impl$5::lock::closure$0<patina_dxe_core::gcd::spin_locked_gcd::GCD>
at D:\a\patina\patina\patina_dxe_core\src\tpl_lock.rs:74
19: 0x7ff7166d23df - enum2$<core::option::Option<patina_dxe_core::tpl_lock::TplGuard<patina_dxe_core::gcd::spin_locked_gcd::GCD> > >::unwrap_or_else<patina_dxe_core::tpl_lock::TplGuard<patina_dxe_core::gcd::spin_locked_gcd::GCD>,patina_dxe_core::tpl_lock::impl$5::lock::closure
at C:\Users\runneradmin\.rustup\toolchains\1.89.0-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\option.rs:1050
20: 0x7ff71687c365 - patina_dxe_core::tpl_lock::TplMutex<patina_dxe_core::gcd::spin_locked_gcd::GCD>::lock<patina_dxe_core::gcd::spin_locked_gcd::GCD>
at D:\a\patina\patina\patina_dxe_core\src\tpl_lock.rs:74
21: 0x7ff716853bb1 - patina_dxe_core::gcd::spin_locked_gcd::SpinLockedGcd::get_memory_descriptor_for_address
at D:\a\patina\patina\patina_dxe_core\src\gcd\spin_locked_gcd.rs:2495
22: 0x7ff7168a690f - patina_dxe_core::allocator::tests::init_memory_support_should_process_resource_allocations
at D:\a\patina\patina\patina_dxe_core\src\allocator.rs:1196
23: 0x7ff7168a6848 - patina_dxe_core::allocator::tests::init_memory_support_should_process_resource_allocations::closure$0
at D:\a\patina\patina\patina_dxe_core\src\allocator.rs:1155
24: 0x7ff7167f6c72 - core::ops::function::FnOnce::call_once<patina_dxe_core::allocator::tests::init_memory_support_should_process_resource_allocations::closure_env$0,tuple$<> >
at C:\Users\runneradmin\.rustup\toolchains\1.89.0-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:250
25: 0x7ff7169668b0 - core::ops::function::FnOnce::call_once
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\core\src\ops\function.rs:250
26: 0x7ff7169668b0 - test::__rust_begin_short_backtrace<enum2$<core::result::Result<tuple$<>,alloc::string::String> >,enum2$<core::result::Result<tuple$<>,alloc::string::String> > (*)()>
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\test\src\lib.rs:648
27: 0x7ff7169652e3 - test::run_test_in_process
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\test\src\lib.rs:671
28: 0x7ff7169652e3 - test::run_test::closure$0
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\test\src\lib.rs:592
29: 0x7ff71692033c - test::run_test::closure$1
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\test\src\lib.rs:622
30: 0x7ff71692033c - std::sys::backtrace::__rust_begin_short_backtrace<test::run_test::closure_env$1,tuple$<> >
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\sys\backtrace.rs:152
31: 0x7ff7169247cd - core::ops::function::FnOnce::call_once<std::thread::impl$0::spawn_unchecked_::closure_env$1<test::run_test::closure_env$1,tuple$<> >,tuple$<> >
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\core\src\ops\function.rs:250
32: 0x7ff716a93f9d - alloc::boxed::impl$28::call_once
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\alloc\src\boxed.rs:1966
33: 0x7ff716a93f9d - alloc::boxed::impl$28::call_once
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\alloc\src\boxed.rs:1966
34: 0x7ff716a93f9d - std::sys::pal::windows::thread::impl$0::new::thread_start
at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library\std\src\sys\pal\windows\thread.rs:60
35: 0x7ffbaf054cb0 - BaseThreadInitThunk
36: 0x7ffbb09dedcb - RtlUserThreadStart
failures:
allocator::tests::init_memory_support_should_process_resource_allocations
test result: FAILED. 368 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.53s
error: test failed, to rerun pass `-p patina_dxe_core --lib`
error: process didn't exit successfully: `C:\Users\runneradmin\.rustup\toolchains\1.89.0-x86_64-pc-windows-msvc\bin\cargo.exe test --tests --profile test --manifest-path D:\a\patina\patina\Cargo.toml --target-dir D:\a\patina\patina\target\llvm-cov-target --features enable_patina_tests --workspace` (exit code: 101)
Error while executing command, exit code: 1
Expected Behavior
Unit tests run without failures.
Steps To Reproduce
Run cargo make test until issue reproduces.
Build Environment
Has been observed when running unit tests on Windows.
Version Information
Tag: patina-v8.1.0
Urgency
Medium
Are you going to fix this?
Someone else needs to fix it
Do you need maintainer feedback?
No maintainer feedback needed
Anything else?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.