d3d12_xs: cargo test --lib -- --test-threads=1 ends with exit code 0x887A0006 about 3 s in (dred test arms the removed-device exit timer) #192

Closed
opened 2026-11-26 06:13:21 +00:00 by github-bot · 1 comment
Owner

@⁠kiwe147 on GitHub · 2026-11-22 23:29 UTC · original

On main 30a1b53, cargo test --locked -p d3d12_xs --lib -- --test-threads=1 stops in the middle of the run and cargo reports process didn't exit successfully ... (exit code: 0x887a0006). On my machine it died in upload::zero_watch_tests::guarded_reads_cost_one_call_per_range_not_per_byte in 3 of 3 runs, with 553 tests passed before it. That test passes alone (3 of 3), together with every single other module (88 modules tried one at a time), and in the default parallel run (cargo test --lib: 581 passed, 1 failed = the console-dump fixture test, 5 of 5 runs).

Cause (found by reading the code and checking with the switch below; I did not trace which test arms it): the exit code is the one dred::exit_code returns when the GPU device is lost. The only test caller of report_once that I found is the dred test at crates/compat/d3d12_xs/src/dred.rs:663, report_once("test", None). When a device pointer has been stored by then, that goes to schedule_exit, which starts a thread that sleeps TOMBOX_REMOVED_EXIT_MS (3000 ms by default) and then calls ExitProcess(0x887A0006). The process is killed by that thread, whatever test is running 3 s later. The parallel run finishes in about 2.2 s, so it ends before the timer fires. The single-threaded run takes longer than 3 s (about 6.5 s), so the timer fires in the middle of it.

Check: with TOMBOX_REMOVED_EXIT_MS=off, the same single-threaded run finishes: 581 passed, 1 failed (the console-dump fixture test), 44 ignored.

Possible fix: have the test set TOMBOX_REMOVED_EXIT_MS=off before it calls report_once, or skip schedule_exit under cfg(test).

Why it matters: --test-threads=1 is the mode used in issue #157 and the one the maintainers asked for there, and it is the mode where a failed or hung test is easiest to find. Right now it reports a crash that is not a test failure.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC (VS Build Tools 17.14), Rust 1.91.1, main 30a1b53.

AI-assisted: yes (Claude Code)

**@⁠kiwe147** on GitHub · 2026-11-22 23:29 UTC · [original](https://github.com/omonkeyz/xbox-emulator/issues/192) On `main` `30a1b53`, `cargo test --locked -p d3d12_xs --lib -- --test-threads=1` stops in the middle of the run and cargo reports `process didn't exit successfully ... (exit code: 0x887a0006)`. On my machine it died in `upload::zero_watch_tests::guarded_reads_cost_one_call_per_range_not_per_byte` in 3 of 3 runs, with 553 tests passed before it. That test passes alone (3 of 3), together with every single other module (88 modules tried one at a time), and in the default parallel run (`cargo test --lib`: 581 passed, 1 failed = the console-dump fixture test, 5 of 5 runs). Cause (found by reading the code and checking with the switch below; I did not trace which test arms it): the exit code is the one `dred::exit_code` returns when the GPU device is lost. The only test caller of `report_once` that I found is the `dred` test at `crates/compat/d3d12_xs/src/dred.rs:663`, `report_once("test", None)`. When a device pointer has been stored by then, that goes to `schedule_exit`, which starts a thread that sleeps `TOMBOX_REMOVED_EXIT_MS` (3000 ms by default) and then calls `ExitProcess(0x887A0006)`. The process is killed by that thread, whatever test is running 3 s later. The parallel run finishes in about 2.2 s, so it ends before the timer fires. The single-threaded run takes longer than 3 s (about 6.5 s), so the timer fires in the middle of it. Check: with `TOMBOX_REMOVED_EXIT_MS=off`, the same single-threaded run finishes: 581 passed, 1 failed (the console-dump fixture test), 44 ignored. Possible fix: have the test set `TOMBOX_REMOVED_EXIT_MS=off` before it calls `report_once`, or skip `schedule_exit` under `cfg(test)`. Why it matters: `--test-threads=1` is the mode used in issue #157 and the one the maintainers asked for there, and it is the mode where a failed or hung test is easiest to find. Right now it reports a crash that is not a test failure. Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, NVIDIA GeForce RTX 3080 (driver 621.24), MSVC (VS Build Tools 17.14), Rust 1.91.1, `main` `30a1b53`. AI-assisted: yes (Claude Code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:13:21 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 13:12 UTC · original

Fixed on main in 6e6095f: in test builds schedule_exit only records the exit code (TEST_EXIT) and never calls ExitProcess, so a --test-threads=1 run is no longer killed 3 s after the dred test. Thanks for the clear report.

**@⁠omonkeyz** on GitHub · 2026-11-23 13:12 UTC · [original](https://github.com/omonkeyz/xbox-emulator/issues/192#issuecomment-7102201136) Fixed on main in 6e6095f: in test builds schedule_exit only records the exit code (TEST_EXIT) and never calls ExitProcess, so a --test-threads=1 run is no longer killed 3 s after the dred test. Thanks for the clear report.
This discussion has been locked. Commenting is limited to contributors.
No description provided.