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

Merged
DavidM1911 merged 1 commit from upstream-pr/471 into main 2026-11-25 01:07:43 +00:00
DavidM1911 commented 2026-11-24 00:46:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T00:46:34Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:6572005198 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/471). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T00:46:34Z. --- 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.
ethandepstein-del commented 2026-11-24 07:05:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ethandepstein-del on 2026-11-24T01:02:14Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7118687780 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/471#issuecomment-7118687780). Originally posted by [ethandepstein-del](https://github.com/ethandepstein-del) on 2026-11-24T01:02:14Z. --- 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.*
MesshM commented 2026-11-24 07:06:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T04:21:28Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7121943627 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/471#issuecomment-7121943627). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T04:21:28Z. --- 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.
upstream-sync closed this pull request 2026-11-25 01:08:35 +00:00
raylitebull commented 2026-11-25 01:10:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T00:56:51Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7149051913 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/471#issuecomment-7149051913). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T00:56:51Z. --- 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.
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!466
No description provided.