startup: a mesh request can miss the exit drain after #3664 (startup_indirect_mesh_cache_heap_wide_warp flaked) #3822

Closed
opened 2026-12-02 04:06:33 +00:00 by lukaslw-lab · 7 comments
lukaslw-lab commented 2026-12-02 04:06:33 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T04:06:33Z.


Since #3664, mesh pipeline requests are written by RequestPublisher on a background thread. In one CI run the request file was never written, and the fixture failed:

x2w-render stream pipeline -> placeholder: slot86 mesh request 2c820f987671b4fc pending
...
  File "tests\startup_indirect_mesh_cache_check.py", line 205, in run_heap
    marker, = work.glob('req_*.m86')
ValueError: not enough values to unpack (expected 1, got 0)
Run Tree startup_indirect_mesh_cache_heap_wide_warp
PR #3712, Windows job 1620be9d merged with main 0dd65da1 failed, as above
main 0dd65da1 (run later cancelled) passed
PR #3707 (edadb494, includes #3664) passed

#3712 does not touch request publishing. I could not reproduce it locally: on this Windows 10 host the WARP variant skips with no mesh shaders, and the hardware variant fails before the draw.

One path that fits, from reading src/startup_stubs/request_publisher.h at 0dd65da1:

  • At exit, ExitProcess ends the writer thread before MeshRequestDrain runs (d3d12_draw.inl:651-654). drain() then writes what is still queued, but only after TryAcquireSRWLockExclusive(&lock_). If that fails, it returns 0 and writes nothing (:135, :143).
  • The writer thread holds lock_ outside the file writes: on entry to run() (:209) and while it pops each written request (:190). If the thread is ended in one of those windows, the lock stays held, and the queued request is dropped without a message.
  • A writer thread that starts late on a busy runner widens the first window.

Possible fixes, for the owner of #3664 to choose:

  1. Make the exit path reliable without waiting on a lock the writer may still hold. For example, at the end of a fixture's draw, flush() before returning, or have the drain report a skipped queue instead of returning 0 silently.
  2. Test-only: run the fixtures that read req_* files immediately with X2W_SYNC_MESH_REQUESTS=1. This loses their coverage of the background path, which startup_request_publisher_check still covers.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6736697401 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3822). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-12-02T04:06:33Z. --- Since #3664, mesh pipeline requests are written by `RequestPublisher` on a background thread. In one CI run the request file was never written, and the fixture failed: ``` x2w-render stream pipeline -> placeholder: slot86 mesh request 2c820f987671b4fc pending ... File "tests\startup_indirect_mesh_cache_check.py", line 205, in run_heap marker, = work.glob('req_*.m86') ValueError: not enough values to unpack (expected 1, got 0) ``` | Run | Tree | `startup_indirect_mesh_cache_heap_wide_warp` | |---|---|---| | [PR #3712, Windows job](https://github.com/R0Y00/Xbox2Windows/actions/runs/46799602069/job/143190311270) | `1620be9d` merged with main `0dd65da1` | failed, as above | | main `0dd65da1` (run later cancelled) | | passed | | PR #3707 (`edadb494`, includes #3664) | | passed | #3712 does not touch request publishing. I could not reproduce it locally: on this Windows 10 host the WARP variant skips with no mesh shaders, and the hardware variant fails before the draw. One path that fits, from reading `src/startup_stubs/request_publisher.h` at `0dd65da1`: - At exit, `ExitProcess` ends the writer thread before `MeshRequestDrain` runs (`d3d12_draw.inl:651-654`). `drain()` then writes what is still queued, but only after `TryAcquireSRWLockExclusive(&lock_)`. If that fails, it returns 0 and writes nothing (`:135`, `:143`). - The writer thread holds `lock_` outside the file writes: on entry to `run()` (`:209`) and while it pops each written request (`:190`). If the thread is ended in one of those windows, the lock stays held, and the queued request is dropped without a message. - A writer thread that starts late on a busy runner widens the first window. Possible fixes, for the owner of #3664 to choose: 1. Make the exit path reliable without waiting on a lock the writer may still hold. For example, at the end of a fixture's draw, `flush()` before returning, or have the drain report a skipped queue instead of returning 0 silently. 2. Test-only: run the fixtures that read `req_*` files immediately with `X2W_SYNC_MESH_REQUESTS=1`. This loses their coverage of the background path, which `startup_request_publisher_check` still covers. AI-assisted.
triggered02 commented 2026-12-02 13:34:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-02T13:34:53Z.


Claiming this to try to reproduce it, since a one-off flake by definition resists the person who saw it once.

Slice: reproduction only. I will loop startup_indirect_mesh_cache_heap_wide_warp's command and report how many runs produce ValueError: not enough values to unpack (expected 1, got 0) on work.glob('req_*.m86'). I am not proposing a fix until/unless it reproduces.

How: build startup_indirect_draw_indexed with clang-cl and run tests/startup_indirect_mesh_cache_check.py under the Windows CPython inside Wine + vkd3d-proton, looping the same arguments ctest passes (--heap wide). Translation-layer timing is not Windows timing, so a reproduction here is evidence about the race's existence, not about its Windows probability — and a negative result bounds it, not exonerate it. I will say which of the two I got.

Environment: Debian, clang-cl 19.1.1, xwin SDK 10.0.26100, Wine 11 + vkd3d-proton, GTX 1660 SUPER. No Windows host, no WARP.

Overlap: none — the issue has no comments and no assignee.

Note: my clang-cl build needs the /W4 /WX clang fix from #3855 while I do this, so I will build from a tree that carries it locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7347105860 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3822#issuecomment-7347105860). Originally posted by [triggered02](https://github.com/triggered02) on 2026-12-02T13:34:53Z. --- Claiming this to try to reproduce it, since a one-off flake by definition resists the person who saw it once. **Slice:** reproduction only. I will loop `startup_indirect_mesh_cache_heap_wide_warp`'s command and report how many runs produce `ValueError: not enough values to unpack (expected 1, got 0)` on `work.glob('req_*.m86')`. I am not proposing a fix until/unless it reproduces. **How:** build `startup_indirect_draw_indexed` with clang-cl and run `tests/startup_indirect_mesh_cache_check.py` under the Windows CPython inside Wine + vkd3d-proton, looping the same arguments ctest passes (`--heap wide`). Translation-layer timing is not Windows timing, so a reproduction here is evidence about the race's existence, not about its Windows probability — and a negative result bounds it, not exonerate it. I will say which of the two I got. **Environment:** Debian, clang-cl 19.1.1, xwin SDK 10.0.26100, Wine 11 + vkd3d-proton, GTX 1660 SUPER. No Windows host, no WARP. **Overlap:** none — the issue has no comments and no assignee. Note: my clang-cl build needs the `/W4 /WX` clang fix from #3855 while I do this, so I will build from a tree that carries it locally.
triggered02 commented 2026-12-02 13:38:51 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-02T13:38:51Z.


Reproduction attempt: negative, and the failures I did see are not this issue's signature.

I built startup_indirect_draw_indexed with clang-cl and ran the exact ctest command
(tests/startup_indirect_mesh_cache_check.py <dxc.exe> <fixture.exe> warp --heap wide) under the
Windows CPython in Wine 11 + vkd3d-proton, 20 times.

18 / 20  exit 0, ends with "heap window: two typed buffers, swapped, empty, raw and uint slots
         matched; refusals without a window held; a pre-proof marker was refused"
 2 / 20  exit 1, but NOT the reported ValueError

Both failures are Wine process creation, not request publishing:

File "tests/startup_indirect_mesh_cache_check.py", line 203, in run_heap
    if result := subprocess.run(cmd, env=environment).returncode:
OSError: [WinError 731] Windows Error 0x2db

0x2db is Wine failing to CreateProcess the fixture intermittently under this prefix; the run
had zero fixture output, so it never reached work.glob('req_*.m86') at all. The other failure was
the same shape: 5 lines of output instead of 38, no final summary, no traceback in the file.

So on this host the check is stable, and my loop's flake is an environment artefact. That is not
evidence that the RequestPublisher race does or does not exist — only that a Wine loop is too
noisy to separate it from spawn failures here, and that anyone reproducing this needs a Windows
host or a quieter harness. I am not proposing a fix on this basis.

If it is useful I can re-run the loop with the fixture invoked once per process by a driver script
(one spawn, many iterations inside) to remove the Wine spawn noise — say the word and I will.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7347213502 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3822#issuecomment-7347213502). Originally posted by [triggered02](https://github.com/triggered02) on 2026-12-02T13:38:51Z. --- Reproduction attempt: **negative, and the failures I did see are not this issue's signature.** I built `startup_indirect_draw_indexed` with clang-cl and ran the exact ctest command (`tests/startup_indirect_mesh_cache_check.py <dxc.exe> <fixture.exe> warp --heap wide`) under the Windows CPython in Wine 11 + vkd3d-proton, 20 times. ``` 18 / 20 exit 0, ends with "heap window: two typed buffers, swapped, empty, raw and uint slots matched; refusals without a window held; a pre-proof marker was refused" 2 / 20 exit 1, but NOT the reported ValueError ``` Both failures are Wine process creation, not request publishing: ``` File "tests/startup_indirect_mesh_cache_check.py", line 203, in run_heap if result := subprocess.run(cmd, env=environment).returncode: OSError: [WinError 731] Windows Error 0x2db ``` `0x2db` is Wine failing to `CreateProcess` the fixture intermittently under this prefix; the run had zero fixture output, so it never reached `work.glob('req_*.m86')` at all. The other failure was the same shape: 5 lines of output instead of 38, no final summary, no traceback in the file. So on this host the check is stable, and my loop's flake is an environment artefact. That is not evidence that the `RequestPublisher` race does or does not exist — only that a Wine loop is too noisy to separate it from spawn failures here, and that anyone reproducing this needs a Windows host or a quieter harness. I am not proposing a fix on this basis. If it is useful I can re-run the loop with the fixture invoked once per process by a driver script (one spawn, many iterations inside) to remove the Wine spawn noise — say the word and I will.
triggered02 commented 2026-12-02 15:56:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-02T15:56:52Z.


This flake just reproduced in CI on Windows, so it is not host-specific and not my Wine environment.

On PR #1536's Windows job (run 46916827968), tree with the current fixture fix merged in, startup_indirect_mesh_cache_heap_warp failed after 2.71 s:

Start  398: startup_indirect_mesh_cache_heap_warp
 25/287 Test #398: startup_indirect_mesh_cache_heap_warp ....***Failed    2.71 sec
Traceback (most recent call last):
  File "tests/startup_indirect_mesh_cache_check.py", line 314, in <module>
  File "tests/startup_indirect_mesh_cache_check.py", line 205, in run_heap
ValueError: not enough values to unpack (expected 1, got 0)

That is the same marker, = work.glob('req_*.m86') as in the issue report. The shim log in the same block shows the request still pending at the point the fixture exited:

x2w-render stream pipeline -> placeholder: slot86 mesh request 7d4693893282551e pending

So the pattern is: the request is recorded as pending, the process reaches the glob() before anything wrote req_*.m86, and the fixture exits. That is consistent with the exit-drain race described in the report rather than with anything the test does wrong.

Why this matters for my earlier comment. I reported a negative result from looping the test under Wine (18/20 pass, failures were WinError 731 spawn errors). That result stands as "a Wine loop cannot separate the race from spawn noise" — it was never evidence that the race does not exist. This run is the positive evidence that it does, on the platform where it matters.

I have not changed any code for it. Recording it here because it now has a CI reproduction with a timestamp, which is what a bisect of the drain needs.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7351194335 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3822#issuecomment-7351194335). Originally posted by [triggered02](https://github.com/triggered02) on 2026-12-02T15:56:52Z. --- This flake just reproduced **in CI on Windows**, so it is not host-specific and not my Wine environment. On PR #1536's Windows job ([run 46916827968](https://github.com/R0Y00/Xbox2Windows/actions/runs/46916827968)), tree with the current fixture fix merged in, `startup_indirect_mesh_cache_heap_warp` failed after 2.71 s: ``` Start 398: startup_indirect_mesh_cache_heap_warp 25/287 Test #398: startup_indirect_mesh_cache_heap_warp ....***Failed 2.71 sec Traceback (most recent call last): File "tests/startup_indirect_mesh_cache_check.py", line 314, in <module> File "tests/startup_indirect_mesh_cache_check.py", line 205, in run_heap ValueError: not enough values to unpack (expected 1, got 0) ``` That is the same `marker, = work.glob('req_*.m86')` as in the issue report. The shim log in the same block shows the request still pending at the point the fixture exited: ``` x2w-render stream pipeline -> placeholder: slot86 mesh request 7d4693893282551e pending ``` So the pattern is: the request is recorded as pending, the process reaches the `glob()` before anything wrote `req_*.m86`, and the fixture exits. That is consistent with the exit-drain race described in the report rather than with anything the test does wrong. **Why this matters for my earlier comment.** I reported a negative result from looping the test under Wine (18/20 pass, failures were `WinError 731` spawn errors). That result stands as "a Wine loop cannot separate the race from spawn noise" — it was never evidence that the race does not exist. This run is the positive evidence that it does, on the platform where it matters. I have not changed any code for it. Recording it here because it now has a CI reproduction with a timestamp, which is what a bisect of the drain needs.
triggered02 commented 2026-12-02 15:57:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-02T15:57:34Z.


Two details from that CI run that narrow it, from reading the publication path.

1. Publication is reached — the key exists. The only shim line in the failing block is

x2w-render stream pipeline -> placeholder: slot86 mesh request 7d4693893282551e pending

That key is the FNV chain over ms, ps, root and stream parts (mesh86_cache.inl:262-267), and it is computed immediately before the four publish_shader_request calls (:270-273). So the request reached the publication step; the fixture then found no req_*.m86 in its work directory and died at glob().

2. publish_shader_request is atomic per part, so a torn file is not the explanation: it writes req_<key>.<ext>.<pid>.tmp, CloseHandles, then MoveFileExW to req_<key>.<ext> (d3d12_draw.inl:572-583). A reader either sees the part or does not.

Put together, the remaining explanations are narrow:

  • The write is deferred past process exit — this is what the issue title describes ("a mesh request can miss the exit drain"). If the drain runs on a thread that the fixture's exit does not join, the parts exist logically and never reach the directory.
  • The parts land somewhere else — cache_path resolves per process; if the fixture and the glob() disagree on the directory, the same symptom appears with no race at all.

The way to separate those two is cheap on a Windows host: set the cache directory, run startup_indirect_draw_indexed warp mesh by hand, and check whether req_*.m86 appears in the same directory the shim printed, with the process still running versus after it exits. If it appears only sometimes, it is the drain; if it never appears there but appears in the default location, it is the path.

I have not changed code. Marking this as analysis rather than a diagnosis — I cannot run the fixture here, and I would rather not guess at the drain without seeing it.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7351214167 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3822#issuecomment-7351214167). Originally posted by [triggered02](https://github.com/triggered02) on 2026-12-02T15:57:34Z. --- Two details from that CI run that narrow it, from reading the publication path. **1. Publication is reached — the key exists.** The only shim line in the failing block is ``` x2w-render stream pipeline -> placeholder: slot86 mesh request 7d4693893282551e pending ``` That key is the FNV chain over `ms`, `ps`, `root` and `stream` parts (`mesh86_cache.inl:262-267`), and it is computed immediately before the four `publish_shader_request` calls (`:270-273`). So the request reached the publication step; the fixture then found no `req_*.m86` in its work directory and died at `glob()`. **2. `publish_shader_request` is atomic per part**, so a torn file is not the explanation: it writes `req_<key>.<ext>.<pid>.tmp`, `CloseHandle`s, then `MoveFileExW` to `req_<key>.<ext>` (`d3d12_draw.inl:572-583`). A reader either sees the part or does not. Put together, the remaining explanations are narrow: - **The write is deferred past process exit** — this is what the issue title describes ("a mesh request can miss the exit drain"). If the drain runs on a thread that the fixture's exit does not join, the parts exist logically and never reach the directory. - **The parts land somewhere else** — `cache_path` resolves per process; if the fixture and the `glob()` disagree on the directory, the same symptom appears with no race at all. The way to separate those two is cheap on a Windows host: set the cache directory, run `startup_indirect_draw_indexed warp mesh` by hand, and check whether `req_*.m86` appears in the same directory the shim printed, with the process still running versus after it exits. If it appears only sometimes, it is the drain; if it never appears there but appears in the default location, it is the path. I have not changed code. Marking this as analysis rather than a diagnosis — I cannot run the fixture here, and I would rather not guess at the drain without seeing it.
R0Y00 commented 2026-12-02 16:35:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T16:35:19Z.


The missing .m86 marker still reproduces on trees that include #3854. In #3827 at bae3a4c0 (merged from main 7eebdb44), startup_indirect_mesh_lease_warp_dual failed at the marker lookup in Windows job 143601213253. The re-run is job 143617118802. Separately, the local #3728 trial merge onto 6e3a181b passed the hardware leg but failed in WARP before translation with expected one pending slot 86 request, found [] (test details). These results establish that the symptom survives #3854. The remaining failure mechanism is open. The original reproduction claim stays with triggered02.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7352164550 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3822#issuecomment-7352164550). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T16:35:19Z. --- The missing `.m86` marker still reproduces on trees that include #3854. In #3827 at `bae3a4c0` (merged from main `7eebdb44`), `startup_indirect_mesh_lease_warp_dual` failed at the marker lookup in [Windows job 143601213253](https://github.com/R0Y00/Xbox2Windows/actions/runs/46920760517/job/143601213253). The re-run is [job 143617118802](https://github.com/R0Y00/Xbox2Windows/actions/runs/46920760517/job/143617118802). Separately, the local #3728 trial merge onto `6e3a181b` passed the hardware leg but failed in WARP before translation with `expected one pending slot 86 request, found []` ([test details](https://github.com/R0Y00/Xbox2Windows/pull/3728#pullrequestreview-6154794619)). These results establish that the symptom survives #3854. The remaining failure mechanism is open. The original reproduction claim stays with triggered02.
R0Y00 commented 2026-12-02 17:53:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T17:53:40Z.


I reproduced this on unmodified main b68e954c on Windows 11 build 26300, MSVC Debug, Microsoft Basic Render Driver 10.0.26100.9818, debug layer enabled. Command: ctest --preset dev --no-tests=error -j 1 --repeat until-fail:10 -R '^startup_indirect_mesh_(cache_heap(_wide)?_warp|lease_warp_dual(-trace)?)$' --output-on-failure. cache_heap_warp failed on run 2 and cache_heap_wide_warp on run 5, both after the shim logged the expected request as pending and the fixture found zero .m86 files. lease_warp_dual and lease_warp_dual-trace each passed 10/10. The failure is now reproducible locally on main and independent of the PR changes used to surface it in CI.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7353748090 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3822#issuecomment-7353748090). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T17:53:40Z. --- I reproduced this on unmodified main `b68e954c` on Windows 11 build 26300, MSVC Debug, Microsoft Basic Render Driver 10.0.26100.9818, debug layer enabled. Command: `ctest --preset dev --no-tests=error -j 1 --repeat until-fail:10 -R '^startup_indirect_mesh_(cache_heap(_wide)?_warp|lease_warp_dual(-trace)?)$' --output-on-failure`. `cache_heap_warp` failed on run 2 and `cache_heap_wide_warp` on run 5, both after the shim logged the expected request as pending and the fixture found zero `.m86` files. `lease_warp_dual` and `lease_warp_dual-trace` each passed 10/10. The failure is now reproducible locally on main and independent of the PR changes used to surface it in CI.
mumba17 commented 2026-12-02 19:03:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-12-02T19:03:24Z.


Mechanism for the remaining case, with a fix in #3883 (one commit on 1e2b0d52). triggered02 keeps the reproduction claim. I'm taking the fix, unless R0D4X wants it as a follow-up to #3854.

Cause. drain_at_process_exit (request_publisher.h:178) first checks whether the writer thread is alive and, if so, calls flush() and returns 0. ExitProcess ends the other threads asynchronously, though. At DLL_PROCESS_DETACH the writer's handle can still read as alive, especially when the writer has not been scheduled yet: a fixture that exits right after its first slot 86 request. flush() then waits on idle_, which an ended writer never signals. It times out after the 2 s budget, and nothing is written. #3854 covers the other case: a writer ended while holding lock_, with its handle already signalled.

Evidence. A local-only diagnostic recorded the exit path in each run. Setup: Windows 11 26300, MSVC Debug, WARP, unmodified b68e954c, the first fixture launch of run_heap looped 100 times with every core busy. 21 runs had no .m86. All 21 had terminating=1, writer alive at entry, queue not empty, flush() false after 2.0–2.1 s, the writer ended by then, and 0 requests written. Whenever the writer had already ended at entry and requests were queued (13 runs), the drain wrote them. This also matches the CI failure: cache_heap_warp died at 2.71 s after a single fixture launch, while the whole test passes in 1.0–1.6 s.

Fix. At process exit, wait (within the same timeout) for the writer thread's handle to signal, then drain on the detaching thread as before. The ordinary drain() (FreeLibrary, writer really alive) is unchanged.

const ULONGLONG deadline = GetTickCount64() + timeout_ms;
const HANDLE thread = thread_.load(std::memory_order_acquire);
if (thread && WaitForSingleObject(thread, timeout_ms) != WAIT_OBJECT_0) return 0;

Results

Check Before After
Fixture loop under full CPU load (no .m86) 16/100, then 21/100 0/200 (27 runs had the failing shape and were written; wait for the writer avg 7 ms, max 203 ms)
Your command, --repeat until-fail:30 on the 4 tests n/a 4/4 passed 30× each
New case 5 in startup_request_publisher_check (writer ended 100 ms into the drain) fails 3 checks passes; --mutate inline still fails
ctest -j 1 -R "request_publisher|indirect_mesh|mesh86|mesh_request" 59/59

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7355554232 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3822#issuecomment-7355554232). Originally posted by [mumba17](https://github.com/mumba17) on 2026-12-02T19:03:24Z. --- Mechanism for the remaining case, with a fix in #3883 (one commit on `1e2b0d52`). triggered02 keeps the reproduction claim. I'm taking the fix, unless R0D4X wants it as a follow-up to #3854. **Cause.** `drain_at_process_exit` (`request_publisher.h:178`) first checks whether the writer thread is alive and, if so, calls `flush()` and returns 0. `ExitProcess` ends the other threads asynchronously, though. At `DLL_PROCESS_DETACH` the writer's handle can still read as alive, especially when the writer has not been scheduled yet: a fixture that exits right after its first slot 86 request. `flush()` then waits on `idle_`, which an ended writer never signals. It times out after the 2 s budget, and nothing is written. #3854 covers the other case: a writer ended while holding `lock_`, with its handle already signalled. **Evidence.** A local-only diagnostic recorded the exit path in each run. Setup: Windows 11 26300, MSVC Debug, WARP, unmodified `b68e954c`, the first fixture launch of `run_heap` looped 100 times with every core busy. 21 runs had no `.m86`. All 21 had `terminating=1`, writer alive at entry, queue not empty, `flush()` false after 2.0–2.1 s, the writer ended by then, and 0 requests written. Whenever the writer had already ended at entry and requests were queued (13 runs), the drain wrote them. This also matches the CI failure: `cache_heap_warp` died at 2.71 s after a single fixture launch, while the whole test passes in 1.0–1.6 s. **Fix.** At process exit, wait (within the same timeout) for the writer thread's handle to signal, then drain on the detaching thread as before. The ordinary `drain()` (FreeLibrary, writer really alive) is unchanged. ```cpp const ULONGLONG deadline = GetTickCount64() + timeout_ms; const HANDLE thread = thread_.load(std::memory_order_acquire); if (thread && WaitForSingleObject(thread, timeout_ms) != WAIT_OBJECT_0) return 0; ``` **Results** | Check | Before | After | |---|---|---| | Fixture loop under full CPU load (no `.m86`) | 16/100, then 21/100 | 0/200 (27 runs had the failing shape and were written; wait for the writer avg 7 ms, max 203 ms) | | Your command, `--repeat until-fail:30` on the 4 tests | n/a | 4/4 passed 30× each | | New case 5 in `startup_request_publisher_check` (writer ended 100 ms into the drain) | fails 3 checks | passes; `--mutate inline` still fails | | `ctest -j 1 -R "request_publisher\|indirect_mesh\|mesh86\|mesh_request"` | | 59/59 | AI-assisted (Claude Code).
Sign in to join this conversation.
No labels
No milestone
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.

Reference
R0Y00/Xbox2Windows#3822
No description provided.