Tests: join game-save enumeration reader on unwind #2979

Open
luckyteagirl wants to merge 1 commit from upstream-pr/2979 into main
luckyteagirl commented 2026-11-27 06:24:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-27T06:24:23Z.


Part of #2421. A writer assertion in blob_enumeration_sees_one_submitted_update can unwind while its detached reader still holds a raw pointer to the test's stack Container. This can turn a file-system test failure into a later 0xc0000005. Reporter diagnosis

What is in it

  • Scope the reader to the test and borrow the container for the lifetime of the reader.
  • Signal the reader to stop on both success and unwind so it is joined before the test releases its state. Preserve the existing assertions about snapshot consistency.

Tested

  • A standalone CPU probe extracted the test's thread and assertion control flow, stubbed enumeration without dereferencing the raw pointer, and forced a writer failure after the reader entered. On c2ee10e4, the reader was still active after unwinding. With this change, the reader had exited before unwinding returned to the probe.
  • Windows 11 build 26200, Ryzen 9 5980HX, Rust 1.99.0 MSVC, debug. cargo test --locked -p xcl --lib -j 2 xgameruntime::gamesave::tests -- --test-threads=1 passed 11 tests, 0 failed, 0 ignored, 0 skipped.
  • git diff --check passed.

Regression run

Only the GameSave test changes. Request maintainer review for the test-only label because the path-based checker classifies gamesave.rs as runtime.

Not tested

The complete GPU workspace suite and a retail title. The forced-failure probe models the writer assertion with stubbed I/O. The GameSave unit run uses actual file-system operations. The stale-size, mixed-case temp-file, and sharing-failure production fixes are separate.

AI use

OpenAI Codex (GPT-6.2 Sol) traced the test's reader lifetime, implemented the scoped reader, ran the focused CPU checks, and drafted this description.

<!-- greyfinch-sync:ivall/xcl:issue:5522262794 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2979). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-27T06:24:23Z. --- Part of #2421. A writer assertion in `blob_enumeration_sees_one_submitted_update` can unwind while its detached reader still holds a raw pointer to the test's stack `Container`. This can turn a file-system test failure into a later `0xc0000005`. [Reporter diagnosis](https://github.com/xcl-dev/xcl/issues/2421#issuecomment-7208419589) **What is in it** - Scope the reader to the test and borrow the container for the lifetime of the reader. - Signal the reader to stop on both success and unwind so it is joined before the test releases its state. Preserve the existing assertions about snapshot consistency. **Tested** - A standalone CPU probe extracted the test's thread and assertion control flow, stubbed enumeration without dereferencing the raw pointer, and forced a writer failure after the reader entered. On `c2ee10e4`, the reader was still active after unwinding. With this change, the reader had exited before unwinding returned to the probe. - Windows 11 build 26200, Ryzen 9 5980HX, Rust 1.99.0 MSVC, debug. `cargo test --locked -p xcl --lib -j 2 xgameruntime::gamesave::tests -- --test-threads=1` passed 11 tests, 0 failed, 0 ignored, 0 skipped. - `git diff --check` passed. **Regression run** Only the GameSave test changes. Request maintainer review for the `test-only` label because the path-based checker classifies `gamesave.rs` as runtime. **Not tested** The complete GPU workspace suite and a retail title. The forced-failure probe models the writer assertion with stubbed I/O. The GameSave unit run uses actual file-system operations. The stale-size, mixed-case temp-file, and sharing-failure production fixes are separate. **AI use** OpenAI Codex (GPT-6.2 Sol) traced the test's reader lifetime, implemented the scoped reader, ran the focused CPU checks, and drafted this description.
luckyteagirl commented 2026-11-27 06:25:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-27T06:25:10Z.


Could a maintainer review the diff for the test-only label? The changed lines are entirely inside #[cfg(test)] mod tests in gamesave.rs; the path-based description check currently asks for paired retail smoke. The label would waive that smoke check only. The PR remains a draft because the complete GPU suite has not passed on this machine.

The original NTFS reporter's independent rerun would be especially useful here: the patch should make a writer assertion fail cleanly without a later reader use of the dropped container. It does not claim to fix the writer error, temporary-file filtering, or stale-size problem.

AI use: OpenAI Codex (GPT-6, exact serving variant unavailable) checked the exact diff and drafted this scope request.

<!-- greyfinch-sync:ivall/xcl:comment:7211509459 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2979#issuecomment-7211509459). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-27T06:25:10Z. --- Could a maintainer review the diff for the `test-only` label? The changed lines are entirely inside `#[cfg(test)] mod tests` in `gamesave.rs`; the path-based description check currently asks for paired retail smoke. The label would waive that smoke check only. The PR remains a draft because the complete GPU suite has not passed on this machine. The original NTFS reporter's independent rerun would be especially useful here: the patch should make a writer assertion fail cleanly without a later reader use of the dropped container. It does not claim to fix the writer error, temporary-file filtering, or stale-size problem. AI use: OpenAI Codex (GPT-6, exact serving variant unavailable) checked the exact diff and drafted this scope request.
Foniass commented 2026-12-01 09:15:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:15:53Z.


Triage (#1607) – head 1984a95

#2521 is for the same issue (#2421), but it changes blobs_of (the blob size now comes from a fresh metadata call). This PR only changes the test blob_enumeration_sees_one_submitted_update, so the two do not overlap. The change is correct: the reader is a thread::scope thread that borrows the container instead of holding a raw stack address, and the StopReader drop guard sets done on unwind, so the scope joins the reader before the container is freed. Main still has the old detached-reader version. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7306450378 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2979#issuecomment-7306450378). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:15:53Z. --- **Triage (#1607)** – head 1984a95 #2521 is for the same issue (#2421), but it changes `blobs_of` (the blob size now comes from a fresh `metadata` call). This PR only changes the test `blob_enumeration_sees_one_submitted_update`, so the two do not overlap. The change is correct: the reader is a `thread::scope` thread that borrows the container instead of holding a raw stack address, and the `StopReader` drop guard sets `done` on unwind, so the scope joins the reader before the container is freed. Main still has the old detached-reader version. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2979:upstream-pr/2979'
git switch 'upstream-pr/2979'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2979'
git switch 'upstream-pr/2979'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2979'
git switch 'upstream-pr/2979'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2979'
git switch 'main'
git merge --squash 'upstream-pr/2979'
git switch 'main'
git merge --ff-only 'upstream-pr/2979'
git switch 'main'
git merge 'upstream-pr/2979'
git push origin 'main'
Sign in to join this conversation.
No reviewers
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
xcl-dev/xcl!2979
No description provided.