Skip to content

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

Merged
raylitebull merged 1 commit into
xcl-dev:mainfrom
DavidM1911:acphal-connect-clear
Nov 25, 2026
Merged

raylitebull merged 1 commit into
xcl-dev:mainfrom
DavidM1911:acphal-connect-clear

Conversation

@DavidM1911

@DavidM1911 DavidM1911 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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 xcl-dev#329.

Assisted-by: Devin (SWE-2 Flash Medium)
@mastrr9

mastrr9 commented Nov 24, 2026

Copy link
Copy Markdown

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

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

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.

@raylitebull

Copy link
Copy Markdown
Member

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
raylitebull merged commit 152de4e into xcl-dev:main Nov 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants