acphal: a reconnect drops messages queued for the old channel #471

Manually merged
github merged 1 commit from gh-pr/471/head into gh-pr/471/base 2026-11-26 04:22:45 +00:00
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 00:46 UTC · original
DavidM1911:acphal-connect-clear → main · +15 −0 · 1 files · 1 commits · merged 2026-11-25 01:07 UTC

Part of #329 (item 2).

Channel::connect() left self.messages alone, so a MSG_DISCONNECTED (or stale command acks) queued before a disconnect() surfaced on the fresh connection — a title that disconnects and reconnects immediately would pop a disconnect for a channel that is up. connect() now clears the queue.

What is in it

  • crates/xcl/src/hle/acphal.rs: self.messages.clear() in Channel::connect(); a test connects, disconnects without popping, reconnects, and checks the next pop is not the stale MSG_DISCONNECTED.

Tested

  • Windows 11, Ryzen 9 7900X (Radeon iGPU + NVIDIA RTX 3060 Ti 8 GB, driver 610.88), Rust 1.100.0 x86_64-pc-windows-msvc:
    • cargo test -p xcl --lib acphal: 8 passed, 0 failed
    • cargo test --workspace -- --test-threads=4: 677 passed, 0 failed, 41 ignored
  • Regression run on the retail title (1.0.2.1, own copy), RTX 3060 Ti, scripts/smoke.ps1 -Seconds 60, cargo build --release -p xcl:

main a6f5f7a (same run as reported on the sibling #329 PRs):

xcl-smoke v1
commit: a6f5f7a74cc620c1f88a9e3669a633d10c3c8212
gpu: NVIDIA GeForce RTX 3060 Ti
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1503 (PresentX 1503)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14437 MB

this PR's head cf6157a:

xcl-smoke v1
commit: cf6157af0953779c3a875337c0f098289ab72b9c
gpu: NVIDIA GeForce RTX 3060 Ti
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1525 (PresentX 1525)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14458 MB

Not tested

  • AMD adapter smoke run; a real disconnect/reconnect sequence on a title (timing-dependent — the unit test covers the queue behaviour)

AI use

  • Devin (SWE-2 Flash Medium): implemented the fix and test, ran the suites and smoke runs.
**@⁠DavidM1911** on GitHub · 2026-11-24 00:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/471) `DavidM1911:acphal-connect-clear` → `main` · +15 −0 · 1 files · 1 commits · merged 2026-11-25 01:07 UTC Part of #329 (item 2). `Channel::connect()` left `self.messages` alone, so a `MSG_DISCONNECTED` (or stale command acks) queued before a `disconnect()` surfaced on the fresh connection — a title that disconnects and reconnects immediately would pop a disconnect for a channel that is up. `connect()` now clears the queue. **What is in it** - `crates/xcl/src/hle/acphal.rs`: `self.messages.clear()` in `Channel::connect()`; a test connects, disconnects without popping, reconnects, and checks the next `pop` is not the stale `MSG_DISCONNECTED`. **Tested** - Windows 11, Ryzen 9 7900X (Radeon iGPU + NVIDIA RTX 3060 Ti 8 GB, driver 610.88), Rust 1.100.0 `x86_64-pc-windows-msvc`: - `cargo test -p xcl --lib acphal`: 8 passed, 0 failed - `cargo test --workspace -- --test-threads=4`: 677 passed, 0 failed, 41 ignored - Regression run on the retail title (1.0.2.1, own copy), RTX 3060 Ti, `scripts/smoke.ps1 -Seconds 60`, `cargo build --release -p xcl`: main `a6f5f7a` (same run as reported on the sibling #329 PRs): ``` xcl-smoke v1 commit: a6f5f7a74cc620c1f88a9e3669a633d10c3c8212 gpu: NVIDIA GeForce RTX 3060 Ti title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1503 (PresentX 1503) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14437 MB ``` this PR's head `cf6157a`: ``` xcl-smoke v1 commit: cf6157af0953779c3a875337c0f098289ab72b9c gpu: NVIDIA GeForce RTX 3060 Ti title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1525 (PresentX 1525) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14458 MB ``` **Not tested** - AMD adapter smoke run; a real disconnect/reconnect sequence on a title (timing-dependent — the unit test covers the queue behaviour) **AI use** - Devin (SWE-2 Flash Medium): implemented the fix and test, ran the suites and smoke runs.
Channel::connect() left self.messages alone, so a MSG_DISCONNECTED (or
stale command acks) queued before a disconnect surfaced on the fresh
connection. Clear the queue on connect. Part of #329.

Assisted-by: Devin (SWE-2 Flash Medium)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:22:44 +00:00
github manually merged commit cf6157af09 into gh-pr/471/base 2026-11-26 04:22:45 +00:00
Author
Owner

@⁠mastrr9 on GitHub · 2026-11-24 01:02 UTC · original

Code audit + NVIDIA RTX 5080 test run on cf6157af0953779c3a875337c0f098289ab72b9c (part of #329):

Review

Looks clean — clearing self.messages in Channel::connect() prevents stale MSG_DISCONNECTED or command completions from leaking across a reconnect. (Small note: this and #468 both touch Channel::connect, so whichever merges second will need a trivial rebase.)

Tested

  • Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), rustc 1.100.0 (MSVC), debug build.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 677 passed, 0 failed, 41 ignored.
  • New test hle::acphal::tests::reconnect_drops_messages_queued_for_the_old_channel: passed.
  • SKIPPED GPU tests (2, wave32-only adapter): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64.

Not tested

  • Retail title / scripts/smoke.ps1 run (test suite only).
  • AMD / Intel GPUs.

AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.

**@⁠mastrr9** on GitHub · 2026-11-24 01:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/471#issuecomment-7118687780) Code audit + NVIDIA RTX 5080 test run on `cf6157af0953779c3a875337c0f098289ab72b9c` (part of #329): ### Review Looks clean — clearing `self.messages` in `Channel::connect()` prevents stale `MSG_DISCONNECTED` or command completions from leaking across a reconnect. *(Small note: this and #468 both touch `Channel::connect`, so whichever merges second will need a trivial rebase.)* ### Tested - Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), `rustc 1.100.0` (MSVC), debug build. - `cargo build --workspace && cargo test --workspace -- --test-threads=4`: **677 passed, 0 failed, 41 ignored**. - New test `hle::acphal::tests::reconnect_drops_messages_queued_for_the_old_channel`: **passed**. - `SKIPPED` GPU tests (2, wave32-only adapter): `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64`. ### Not tested - Retail title / `scripts/smoke.ps1` run (test suite only). - AMD / Intel GPUs. *AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.*
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 04:21 UTC · original

Test run of cf6157af0953779c3a875337c0f098289ab72b9c on AMD RDNA4. I merged it onto current main f4ce27c locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 702 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 661 passed, 0 failed, 21 ignored
  • 0 SKIPPED; reconnect_drops_messages_queued_for_the_old_channel passes.

Review: Clearing the queue on connect() keeps a stale MSG_DISCONNECTED from surfacing on the new channel. I found nothing to change.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 04:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/471#issuecomment-7121943627) Test run of `cf6157af0953779c3a875337c0f098289ab72b9c` on AMD RDNA4. I merged it onto current `main` `f4ce27c` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **702 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 661 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `reconnect_drops_messages_queued_for_the_old_channel` passes. **Review:** Clearing the queue on `connect()` keeps a stale `MSG_DISCONNECTED` from surfacing on the new channel. I found nothing to change. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 00:56 UTC · original

Diff check on cf6157a:

  • Clearing self.messages in Channel::connect() cleanly prevents stale MSG_DISCONNECTED or prior-channel messages from surfacing after a reconnect.
  • Already verified across both AMD (RX 9060 XT) and NVIDIA (RTX 5080), with PR description passing.

Next step to unblock merge: Please rebase onto current main so CI runs Build and test (Windows, no GPU) on the head.

**@⁠raylitebull** on GitHub · 2026-11-25 00:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/471#issuecomment-7149051913) Diff check on `cf6157a`: - Clearing `self.messages` in `Channel::connect()` cleanly prevents stale `MSG_DISCONNECTED` or prior-channel messages from surfacing after a reconnect. - Already verified across both AMD (`RX 9060 XT`) and NVIDIA (`RTX 5080`), with `PR description` passing. **Next step to unblock merge:** Please rebase onto current `main` so CI runs `Build and test (Windows, no GPU)` on the head.
This discussion has been locked. Commenting is limited to contributors.
No description provided.