Skip to content

xgameruntime: unregistering a network callback with wait from inside that callback returns instead of waiting on itself - #8050

Open
tedin7 wants to merge 1 commit into
ItsNotRexed:mainfrom
tedin7:c2-net-unregister-wait-lifetime
Open

tedin7 wants to merge 1 commit into
ItsNotRexed:mainfrom
tedin7:c2-net-unregister-wait-lifetime

Conversation

@tedin7

@tedin7 tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

What

Avoid waiting on the current thread when a network notification unregisters itself with wait=true. The callback removes its registration when it returns; another thread still waits for completion.

Why

The previous wait could only finish after the callback returned, causing a deadlock inside that callback.

Tested

  • Synthetic xgameruntime_test on p2 with the fast test runner: origin/main dde82f2 failed with the 5-second watchdog (exit 1); corrected commit 1874ff4 passed 145 checks, including self-unregister and another-thread wait.
  • No GPU used; driver not applicable. AI-assisted (Codex).

@ItsNotRexed: an exe PR, as you asked.

Claim: #7913 (comment)

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 1874ff4 on Windows 11, CPU only: pass. I built xgameruntime_test in RelWithDebInfo. I ran ctest -C RelWithDebInfo -R "^xgameruntime$" -V in the build folder. All 145 checks pass. The callback can unregister itself. A second thread waits until the callback returns. I built the same test with the parent implementation at dde82f2. The watchdog stops that run after five seconds with FAIL self-unregister watchdog expired.

AI-assisted.

@myokex

myokex commented Nov 23, 2026

Copy link
Copy Markdown

Tested 1874ff469 merged onto main 867d922f0 on Windows 11, AMD Radeon RX 7800 XT (driver 32.0.32029.2010), MSVC 2022 RelWithDebInfo, Vulkan SDK 1.4.363.0, synthetic only, no game files: pass.

Full ctest -j8: the same 5 failures as main 867d922f0 alone fails the same 5 on this card (vk_queue_query_sync, d3d12_vulkan_device, d3d12_texture_tiles, d3d12_depth_resolve, d3d12_pipeline_library_host, known AMD host issues with open fixes), plus d3d12_bindless_churn once, the shared-temp-folder race that #6184 / #6221 fix: it passes 8/8 run alone, on this branch and on main. All eight xgameruntime* tests pass, including both new unregister checks (self-unregister returns; unregister from another thread waits).

AI-assisted (Claude Code); I read the full diff before building.

@kristofbarany

Copy link
Copy Markdown

Tested 1874ff4 merged onto main 867d922 (clean merge) on NVIDIA GeForce RTX 4070, driver 621.24, native Windows 11 Pro 26300, MSVC 14.44.35207, Ninja RelWithDebInfo: pass.

  • xgameruntime_test: 3 of 3 runs exit 0.
  • The build shows the same 4 warnings main already has in xgameruntime_test.cpp (3x C4996 fopen/_wfopen, C4456 all); this PR adds none.

No game data used. AI-assisted (Claude Code).

@sgonzalez-glitch

Copy link
Copy Markdown

Tested 1874ff469 (as part of #8072, #8163, #8042 and #8050 merged together onto main 867d922f0) on NVIDIA GeForce RTX 2080, driver 621.24 (32.0.16.2124), Windows 11, MSVC 19.44 RelWithDebInfo: pass.

AI-assisted: yes

@comtek21516

Copy link
Copy Markdown

Tested 1874ff469 on main at 867d922f0, in one tree with #8163, #8271, #8222, #8221 (five clean merges; the changes do not depend on each other): pass.

For this change. xgameruntime (xgameruntime_test, with the new unregister-from-inside-the-callback case) passes natively and under Wine on the GPU machine.

Setup. Built with MSVC 14.52 (Visual Studio 18), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.1, Ninja RelWithDebInfo on Windows Server 2025 (no Vulkan driver there), then the same binaries run through scripts/run_wine_tests.py under wine-11.0 (WineHQ stable, xvfb-run) on a Quadro RTX 4000 (Turing), NVIDIA 615.71.09, Ubuntu 22.04.5, where the layer tests report device: Quadro RTX 4000.

passed failed skipped
native Windows, this tree 148 4 124
Wine on the GPU, main 867d922f0 210 12 54
Wine on the GPU, this tree 210 12 55

Under Wine the tree is test by test the same as main; the one extra skip is #8271's new d3d12_trace_file, which the Wine runner does not start (it is driven by Python). The four native failures are gameinput_host, d3d12_sparse_queue_family, vk_bindless_ps_tex and vk_bindless_ps_imgatomic, which fail the same way on main on that machine (#7452). The 12 under Wine are the same 12 as on main: host comparisons Wine cannot answer and three tests also reported failing on native NVIDIA (d3d12_xdxr_rt, d3d12_indirect_rt, d3d12_indirect_dispatch_count).

Because the five were built together, there is no per-PR negative control in this run: a regression would have shown as a difference from main, and there is none. No game files used. AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants