Release PIX transport resources when an XBTP accept finishes #234
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/234"
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?
Imported from omonkeyz/xbox-emulator. Originally posted by bambermf on 2026-11-23T06:24:02Z.
Library / 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.Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-23T06:33:02Z.
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.Imported from omonkeyz/xbox-emulator. Originally posted by bambermf on 2026-11-23T06:50:07Z.
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.Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-23T13:31:25Z.
Included in #250, which is being applied; this will be closed when that ships.
Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:09:24Z.
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