Release PIX transport resources when an XBTP accept finishes #234
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!234
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/234/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@bambermf on GitHub · 2026-11-23 06:24 UTC · original
bambermf:fix/pixrt-listener-cleanup→main· +46 −12 · 2 files · 2 commits · closed without mergingLibrary / area — Shared PIX runtime in
pixrtandpixrt10, device-engine XBTP transport.Exports changed — None.
Source of the behaviour — Static inspection of a local 19041 console
pixrt10.dllwith headless IDA. The listen/accept routine at RVA0x29820calls cleanup on failure. The cleanup at0x29b84releases the listener reference and handles any accepted connection. The destructor at0x29760balances the system reference and disposes of the cancellation event. The runtime measurements below exercise the emulator with its in-process XBTP implementation.What was wrong
Cancelling a pending accept cleared the published PIX link, but service
0x1080still had one listener reference. Neither that listener nor the cancellation event was closed. The session-setup fallback after a successful accept also retained the listener, the system reference and the numeric value of the closed connection handle.The change
Release each acquired listener reference when accept finishes. Close the listener on its last reference, balance system initialization on all exits after acquisition, and clear the published link and dispose of its event under the link lock. Clear the accepted handle when closing the unsupported tool session. Session dispatch remains unfinished.
Measurements and tests
The release suites for both PIX crates passed all 38 tests with local build 19041 DLL fixtures available for the export-table comparisons. This includes cancellation and reopening service
0x1080. Missing listener handles now produce a diagnostic and return from cleanup. No live PIX tool session or gameplay test was performed.@omonkeyz on GitHub · 2026-11-23 06:33 UTC · original
Thanks, releasing the listener, the system reference and the cancel event on every path is the right fix, and the reopen check on 0x1080 in the test is a good way to prove it.
One change before it can be applied:
release_listeneruses.expect("acquired PIX listener"). A panic inside a compat DLL takes the whole title down, which compat crates must never do. Please replace it with a logged early return, for example arecord(...)line saying the listener was not found and then returning. After that, it goes into the next build (r32h), with the pixrt tests passing.@bambermf on GitHub · 2026-11-23 06:50 UTC · original
Fixed in
384b3c6. If cleanup can’t find the PIX listener, it now logs a diagnostic and returns without panicking. All 38 release tests acrosspixrtandpixrt10passed, including the test that cancels the listener and reopens service0x1080. Thanks for catching this.@omonkeyz on GitHub · 2026-11-23 13:31 UTC · original
Included in #250, which is being applied; this will be closed when that ships.
@omonkeyz on GitHub · 2026-11-25 13:09 UTC · original
Applied on main in
8b16440(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.Pull request closed