[GH-ISSUE #5238] The render test suite sometimes hangs when run right after the client's in one cargo test (Windows) #1607

Closed
opened 2026-11-02 15:48:20 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @Qwerner88880 on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5238

Originally assigned to: @Ragbie on GitHub.

🤖 Filed by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally.

On this Windows machine, running the two crates' tests in one invocation — cargo test --locked -p horizon-client -p horizon-client-render --tests, which tools/pr_ready.py does when a change touches both — the horizon-client-render suite sometimes hangs after the horizon-client suites have passed. It never hangs when the render suite runs alone (704 tests in ~10 s), and a rerun is green. Seen three times today on two different branches (#5131's and #5188's pr_ready runs), two shapes:

  • A spin: one core at 100% in the render test process for as long as it's left (an hour the first time, before we killed it). Disappeared in the runs we tried with HORIZON_NO_AUDIO=1, which suggests the audio tests waiting on a device the earlier suite left busy.
  • An exit block: the render binary finishes its tests (17 s of CPU total) and then blocks forever without exiting — with HORIZON_NO_AUDIO=1 set — holding the whole cargo test until the process is killed. The suite then reports failure from the kill alone.

Either way the only way out is killing horizon_client_render-*.exe, after which the same command passes in seconds. The flaky part looks like test isolation between the two suites (audio device handles or a thread that doesn't join at exit), not the suites' own logic — it reproduced identically on branches that touch no render code, and CI's Linux runs of the same suites stay green.

Reproducing it on demand we can't: it is intermittent, maybe one run in two or three. If useful, the next time it happens we can grab a minidump of the stuck process before killing it.

Originally created by @Qwerner88880 on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5238 Originally assigned to: @Ragbie on GitHub. > 🤖 Filed by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally. On this Windows machine, running the two crates' tests in one invocation — `cargo test --locked -p horizon-client -p horizon-client-render --tests`, which `tools/pr_ready.py` does when a change touches both — the horizon-client-render suite sometimes hangs after the horizon-client suites have passed. It never hangs when the render suite runs alone (704 tests in ~10 s), and a rerun is green. Seen three times today on two different branches (#5131's and #5188's `pr_ready` runs), two shapes: - **A spin:** one core at 100% in the render test process for as long as it's left (an hour the first time, before we killed it). Disappeared in the runs we tried with `HORIZON_NO_AUDIO=1`, which suggests the audio tests waiting on a device the earlier suite left busy. - **An exit block:** the render binary finishes its tests (17 s of CPU total) and then blocks forever without exiting — with `HORIZON_NO_AUDIO=1` set — holding the whole `cargo test` until the process is killed. The suite then reports failure from the kill alone. Either way the only way out is killing `horizon_client_render-*.exe`, after which the same command passes in seconds. The flaky part looks like test isolation between the two suites (audio device handles or a thread that doesn't join at exit), not the suites' own logic — it reproduced identically on branches that touch no render code, and CI's Linux runs of the same suites stay green. Reproducing it on demand we can't: it is intermittent, maybe one run in two or three. If useful, the next time it happens we can grab a minidump of the stuck process before killing it.
Author
Owner

@mariuslozo-boop commented on GitHub (Nov 1, 2026):

🤖 Agent: this comment is from mariuslozo-boop's AI agent (Claude Code, Claude Sonnet 5.5 + Claude Opus 5.5 review), not from mariuslozo-boop personally.

We hit the same hang on a second Windows machine, and we have stacks of the stuck process. Two new facts: it also happens when the render suite runs alone, and the stacks point at the NVIDIA driver DLL, not at the audio tests.

Setup. Windows 11, RTX 5070 Ti, NVIDIA driver 616.92, wgpu 30.0.1, debug test build of upstream main 183b53f0e, 16 logical CPUs, CARGO_BUILD_JOBS=4. The Unreal Editor was closed. Wallpaper Engine was running (see "Not known").

Results

Command Result
cargo test --locked -p horizon-client -p horizon-client-render --tests, default threads, run 1 hang in the render lib tests, killed after 600 s
same, run 2 passed
cargo test --locked -p horizon-client-render, default threads (16), 6 runs 5 passed (40 to 53 s), 1 hung (killed at 150 s)
same, RUST_TEST_THREADS=1, 2, 4, 8, one run each no hang

So the render suite alone can hang too, which #5238 says it never does. We saw it 1 time in 6 at the default thread count. The one-run-each thread counts are too few to say a lower count is safe. Earlier today, with the Unreal Editor open and using the GPU, the same suite hung at 4 or more threads and passed at 1 and 2.

What the stuck process looks like. We attached lldb to the stuck horizon_client_render-*.exe (a minidump is also saved, 544 MB) in the combined run and in the alone run. Same picture both times:

  • Two threads sit at 100% CPU (9.6 CPU-seconds over a 5 s window). Both are in GetExitCodeThread, called from nvoglv64.dll, which is NVIDIA's OpenGL/Vulkan driver. That is the "one core at 100%" in this issue.
    • One is a test thread that has already finished and is exiting: LdrShutdownThread -> nvoglv64.dll DllMain -> GetExitCodeThread.
    • The other is inside wgpu_hal::gles::wgl::Instance::init -> wglGetExtensionsStringARB -> nvoglv64.dll -> GetExitCodeThread.
  • Most of the other threads are parked. In the combined run: 16 threads in LdrShutdownThread -> RtlFreeActivationContextStack -> NtWaitForSingleObject (exiting threads, including 8 D3D background threads), 3 in LoadLibraryExW, and 2 in a critical section inside vulkan-1.dll. In the alone run: 6 in LdrShutdownThread, 2 in LoadLibraryExW, 10 in vulkan-1.dll critical sections (vkCreateInstance, vkCreateDevice, vkEnumeratePhysicalDevices). That looks like threads waiting on a lock that never comes back. We think it is the loader lock, but we did not check which lock it is.
  • The libtest runner never sees some tests finish because their threads cannot exit. In the combined run, 6 of the 16 tests still "running" (including the spinner above) had finished their bodies and were stuck in thread exit. This may be the same thing as the "exit block" shape in this issue.
  • Tests still running (16 test threads each time). Combined run: gfx::pack_atlas::tests::layers_land_in_their_cells, gfx::world_post::tests::world_post_pipelines_compile_or_fall_back, gfx::pack_post::tests::a_shader_compiler_panic_skips_the_pass, gfx::frame_gen::interpolation::tests::* (2), gfx::readback::tests::* (2), gfx::upload::tests::* (3), gfx::panorama::tests::*, gfx::sunrise_fan::tests::* and 4 hud::tests::*. Alone run: gfx::arena::tests::* (6), gfx::frame_gen::* (5), gfx::end_sky::tests::* (2), gfx::animate, gfx::flat, assets::tests::always_edible_and_consume_effects_loaded.
  • The hang is in the middle of the run, after about 400 of 927 tests.

How the tests use the GPU. There is no shared device. Each GPU test builds its own wgpu::Instance::new(wgpu::InstanceDescriptor::new_without_display_handle()) and then its own adapter and device (for example crates/horizon-client-render/src/gfx/upload.rs:127, gfx/animate.rs:737, gfx/arena.rs:523; 21 request_device calls in 19 files under crates/horizon-client-render). We found no lock, OnceLock or other limit around this in gfx. With the default backends, each of those instances starts Vulkan, DirectX 12 and OpenGL (WGL) in one process. All three show up in the stacks (vulkan-1.dll, D3D12Core.dll / nvwgf2umx.dll, wgpu-hal WGL Instance Thread). Up to 16 tests do this at once at the default thread count. These helpers use new_without_display_handle(), not the _from_env version, so WGPU_BACKEND does not change what they open.

Not known

  • We did not prove the cause. The stacks fit a deadlock inside the NVIDIA user-mode driver when many threads create and drop instances, devices and threads at the same time, but we did not test a fix (for example one shared device, or a single backend).
  • We did not test on another GPU or driver.
  • This machine also has Wallpaper Engine's we-graphics-hook64.dll and amdihk64.dll loaded into the test process. We did not test without them.
  • We did not check why the combined run seemed to hang more often than the alone run. With 2 runs and 6 runs, that may be chance.
  • We did not try HORIZON_NO_AUDIO=1. These stacks show no audio code.
<!-- gh-comment-id:6560699904 --> @mariuslozo-boop commented on GitHub (Nov 1, 2026): 🤖 Agent: this comment is from mariuslozo-boop's AI agent (Claude Code, Claude Sonnet 5.5 + Claude Opus 5.5 review), not from mariuslozo-boop personally. We hit the same hang on a second Windows machine, and we have stacks of the stuck process. Two new facts: it also happens when the render suite runs alone, and the stacks point at the NVIDIA driver DLL, not at the audio tests. **Setup.** Windows 11, RTX 5070 Ti, NVIDIA driver 616.92, wgpu 30.0.1, debug test build of upstream main `183b53f0e`, 16 logical CPUs, `CARGO_BUILD_JOBS=4`. The Unreal Editor was closed. Wallpaper Engine was running (see "Not known"). **Results** | Command | Result | | --- | --- | | `cargo test --locked -p horizon-client -p horizon-client-render --tests`, default threads, run 1 | hang in the render lib tests, killed after 600 s | | same, run 2 | passed | | `cargo test --locked -p horizon-client-render`, default threads (16), 6 runs | 5 passed (40 to 53 s), 1 hung (killed at 150 s) | | same, `RUST_TEST_THREADS=1`, `2`, `4`, `8`, one run each | no hang | So the render suite alone can hang too, which #5238 says it never does. We saw it 1 time in 6 at the default thread count. The one-run-each thread counts are too few to say a lower count is safe. Earlier today, with the Unreal Editor open and using the GPU, the same suite hung at 4 or more threads and passed at 1 and 2. **What the stuck process looks like.** We attached lldb to the stuck `horizon_client_render-*.exe` (a minidump is also saved, 544 MB) in the combined run and in the alone run. Same picture both times: - Two threads sit at 100% CPU (9.6 CPU-seconds over a 5 s window). Both are in `GetExitCodeThread`, called from `nvoglv64.dll`, which is NVIDIA's OpenGL/Vulkan driver. That is the "one core at 100%" in this issue. - One is a test thread that has already finished and is exiting: `LdrShutdownThread` -> `nvoglv64.dll` `DllMain` -> `GetExitCodeThread`. - The other is inside `wgpu_hal::gles::wgl::Instance::init` -> `wglGetExtensionsStringARB` -> `nvoglv64.dll` -> `GetExitCodeThread`. - Most of the other threads are parked. In the combined run: 16 threads in `LdrShutdownThread` -> `RtlFreeActivationContextStack` -> `NtWaitForSingleObject` (exiting threads, including 8 D3D background threads), 3 in `LoadLibraryExW`, and 2 in a critical section inside `vulkan-1.dll`. In the alone run: 6 in `LdrShutdownThread`, 2 in `LoadLibraryExW`, 10 in `vulkan-1.dll` critical sections (`vkCreateInstance`, `vkCreateDevice`, `vkEnumeratePhysicalDevices`). That looks like threads waiting on a lock that never comes back. We think it is the loader lock, but we did not check which lock it is. - The libtest runner never sees some tests finish because their threads cannot exit. In the combined run, 6 of the 16 tests still "running" (including the spinner above) had finished their bodies and were stuck in thread exit. This may be the same thing as the "exit block" shape in this issue. - Tests still running (16 test threads each time). Combined run: `gfx::pack_atlas::tests::layers_land_in_their_cells`, `gfx::world_post::tests::world_post_pipelines_compile_or_fall_back`, `gfx::pack_post::tests::a_shader_compiler_panic_skips_the_pass`, `gfx::frame_gen::interpolation::tests::*` (2), `gfx::readback::tests::*` (2), `gfx::upload::tests::*` (3), `gfx::panorama::tests::*`, `gfx::sunrise_fan::tests::*` and 4 `hud::tests::*`. Alone run: `gfx::arena::tests::*` (6), `gfx::frame_gen::*` (5), `gfx::end_sky::tests::*` (2), `gfx::animate`, `gfx::flat`, `assets::tests::always_edible_and_consume_effects_loaded`. - The hang is in the middle of the run, after about 400 of 927 tests. **How the tests use the GPU.** There is no shared device. Each GPU test builds its own `wgpu::Instance::new(wgpu::InstanceDescriptor::new_without_display_handle())` and then its own adapter and device (for example `crates/horizon-client-render/src/gfx/upload.rs:127`, `gfx/animate.rs:737`, `gfx/arena.rs:523`; 21 `request_device` calls in 19 files under `crates/horizon-client-render`). We found no lock, `OnceLock` or other limit around this in `gfx`. With the default backends, each of those instances starts Vulkan, DirectX 12 and OpenGL (WGL) in one process. All three show up in the stacks (`vulkan-1.dll`, `D3D12Core.dll` / `nvwgf2umx.dll`, `wgpu-hal WGL Instance Thread`). Up to 16 tests do this at once at the default thread count. These helpers use `new_without_display_handle()`, not the `_from_env` version, so `WGPU_BACKEND` does not change what they open. **Not known** - We did not prove the cause. The stacks fit a deadlock inside the NVIDIA user-mode driver when many threads create and drop instances, devices and threads at the same time, but we did not test a fix (for example one shared device, or a single backend). - We did not test on another GPU or driver. - This machine also has Wallpaper Engine's `we-graphics-hook64.dll` and `amdihk64.dll` loaded into the test process. We did not test without them. - We did not check why the combined run seemed to hang more often than the alone run. With 2 runs and 6 runs, that may be chance. - We did not try `HORIZON_NO_AUDIO=1`. These stacks show no audio code.
Author
Owner

@Ragbie commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6561983052 --> @Ragbie commented on GitHub (Nov 1, 2026): /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1607
No description provided.