XAsync: publish the final status before removing a completed call #23

Closed
github-bot wants to merge 1 commit from gh-pr/23/head into gh-pr/23/base
Owner

@⁠Jineggegg on GitHub · 2026-11-28 15:46 UTC · original
Jineggegg:xasync-publish-before-remove → main · +91 −22 · 1 files · 1 commits · closed without merging

What this fixes

An error or zero-size completion removed its call before provider cleanup ran. A blocking status query (XAsyncGetStatus with wait) could miss the call during cleanup and read E_PENDING instead of the work result.

This change:

  • Keeps the claimed call registered and visible to waiters throughout the unlocked provider cleanup, and excludes it from new work while it completes.
  • Publishes the status first, then removes the entry under the registry lock.
  • Records the call result in the call itself, so existing waiters get the real result even if the block is reused for another call.
  • Adds a regression test that pauses cleanup mid-way and checks a waiting status query still returns the completion result (E_ABORT), not E_PENDING.

Testing

  • cargo check -p victory-hle --lib: clean (only pre-existing warnings elsewhere).
  • cargo test -p victory-hle --lib xasync: 13 passed, 0 failed, including the new status_waits_for_cleanup_to_publish_the_result test.
  • The same fix was verified on an RTX 5090 in Jineggegg/VIctory round 1 (deterministic race test plus the full XAsync suite).

Origin

Adapted from Jineggegg/VIctory e071177 (round-1 item #3). Foxhound had no claimed flag — its first-completion guard was the done lock — so this port brings the claimed flag in, and completing, cancelling and scheduled work now agree on which calls are still live.

**@⁠Jineggegg** on GitHub · 2026-11-28 15:46 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/23) `Jineggegg:xasync-publish-before-remove` → `main` · +91 −22 · 1 files · 1 commits · closed without merging ## What this fixes An error or zero-size completion removed its call before provider cleanup ran. A blocking status query (`XAsyncGetStatus` with wait) could miss the call during cleanup and read `E_PENDING` instead of the work result. This change: - Keeps the claimed call registered and visible to waiters throughout the unlocked provider cleanup, and excludes it from new work while it completes. - Publishes the status first, then removes the entry under the registry lock. - Records the call result in the call itself, so existing waiters get the real result even if the block is reused for another call. - Adds a regression test that pauses cleanup mid-way and checks a waiting status query still returns the completion result (`E_ABORT`), not `E_PENDING`. ## Testing - `cargo check -p victory-hle --lib`: clean (only pre-existing warnings elsewhere). - `cargo test -p victory-hle --lib xasync`: 13 passed, 0 failed, including the new `status_waits_for_cleanup_to_publish_the_result` test. - The same fix was verified on an RTX 5090 in Jineggegg/VIctory round 1 (deterministic race test plus the full XAsync suite). ## Origin Adapted from Jineggegg/VIctory `e071177` (round-1 item #3). Foxhound had no `claimed` flag — its first-completion guard was the `done` lock — so this port brings the `claimed` flag in, and completing, cancelling and scheduled work now agree on which calls are still live.
An error or zero-size completion removed its call before provider cleanup. A blocking status query could miss the call during cleanup and read E_PENDING instead of the work result.

Keep the claimed call available to waiters during unlocked cleanup, exclude it from new work, then publish the status and remove the entry under the registry lock. Return the captured call result to existing waiters even if the block is reused. Exercise the race deterministically with a paused cleanup.

Adapted from Jineggegg/VIctory e071177. Foxhound had no claimed flag: its first-completion guard was the done lock. This port brings the claimed flag in, so completing, cancelling and scheduled work all agree on which calls are still live.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 02:23:15 +00:00
github-bot closed this pull request 2026-11-30 02:23:15 +00:00
Author
Owner

@⁠readmet3xt-lab on GitHub · 2026-11-29 08:10 UTC · original

Thanks for the fix and the regression test. Ported with credit (commit 6c67166) and released in v0.8.1: https://github.com/readmet3xt-lab/foxhound/releases/tag/v0.8.1. It may also be behind issue #35 (a start that stalls before sign-in on a 24-thread CPU); I've asked that reporter to retest.

**@⁠readmet3xt-lab** on GitHub · 2026-11-29 08:10 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/23#issuecomment-7252930610) Thanks for the fix and the regression test. Ported with credit (commit 6c67166) and released in v0.8.1: https://github.com/readmet3xt-lab/foxhound/releases/tag/v0.8.1. It may also be behind issue #35 (a start that stalls before sign-in on a 24-thread CPU); I've asked that reporter to retest.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.