Skip to content

fix(audioout): retain port storage during process finalization - #61

Closed
JJenkx wants to merge 1 commit into
mainfrom
fix/audioout2-port-table-lifetime
Closed

JJenkx wants to merge 1 commit into
mainfrom
fix/audioout2-port-table-lifetime

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Superseded by upstream #6000, merged into main. The maintainer closed upstream #5971 because its exit guard parks new guest audio calls and waits for active calls before static destruction, removing the need for process-lifetime port storage. This fork review copy is closed for the same reason; its branch is preserved.

Validation of the replacement: main ab9a4768407d862d1879d7d0ee66bd9c3d9d67a8 plus only the separate SPIRV-Tools constant-validator-table shutdown repair, with this PR's AudioOut2 lifetime change absent. Full guest libraries build; 15 selected graphics/shader/audio checks pass without skips on Radeon and lavapipe, including all four new audio-shutdown cases. Astro PPSA21564 reached standing Crash Site / HUD 301 from a fresh shader cache. Normal window close at 585.96 s completed with process exit 0 at 592.85 s and restored the temporary kernel setting. This is one native closure, not proof of every shutdown path. The earlier investigation below applies to its stated revisions.


What

Keep the AudioOut2 port vector and its mutex alive until process termination. Guest audio calls can continue while the host runs static destructors; destroying the table lets AudioOut2CaptureGrain pop queued pointers from destroyed deques. Explicit port/context destruction still releases entries and slots remain reusable during normal execution. This records the remaining process-finalization ordering gap in technical debt.

The trigger was Astro Bot PPSA21564 closing its window after reaching the hub. Two runs aborted with double free or corruption (out). In the debugger-assisted repeat, the abort came from the 512-byte deque-block deallocation in AudioOut2CaptureGrain, called by sceAudioOut2ContextPush, while another thread was inside host exit and static destruction. This change gives the shared table the lifetime its callers require; it does not alter PCM conversion or mixing.

Tested

Linux x86-64, GCC Release: all five AudioOut2 cases pass with SDL dummy audio: pad mix, latency, port layouts, port buffers and timing. Final-source cases pass in 3.70 seconds.

Native Astro validation used the existing converted PPSA21564 app, -lvl hub_crashsite, on a pinned local compact-capture stack based on main e34c47921. Compact-versus-IR verification stayed enabled. The original stack exited 134 both without a debugger and under GDB. The vector-lifetime repair reached the same hub and exited 0 under GDB after a normal close request at 214.25 seconds; the failing warm repeat was closed at 214.30 seconds. Kernel settings were restored. The final version also retains the mutex for the same lifetime. Its debugger-free repeat reached the standing hub, accepted a normal close at 230.13 seconds and exited 0; kernel settings were restored. The final source passes the five AudioOut2 cases again. Thus both original runs aborted, while both repaired runs closed cleanly (one under GDB, one without it). No FPS or audio-quality improvement is claimed.

This branch is one commit on main e154f565852. Its AudioOut2Port.cpp blob is identical to the final native-validation stack; the compact-capture changes are not included in this PR. Full Linux/Windows CI run 38607889852 passed for the standalone repair on main e154f565852: Linux 1,118 passed / 57 skipped; Windows 766 passed / 433 skipped; zero failures. All five AudioOut2 cases ran and passed on both platforms. The final native repeat has also passed. Raw title logs and binaries remain local.

Two additional native Astro runs on private integration 980559f158d (main 4d5411d7b5d plus the prebuilt-pack topics and this repair) also reached the standing hub and exited 0 after normal close requests. These validate shutdown on that recorded integration; they do not isolate an audio-quality or FPS change.

Checklist

  • Based on main e154f565852; focused host-lifetime repair
  • Generic behavior, no title-specific paths or suppressed errors
  • No new runtime switches or third-party code
  • Depends on: none
  • Unblocks: none (title already starts; fixes a shutdown failure)
  • GPUs tested: n/a (AudioOut2 lifetime); native scene used AMD RX 6650 XT, RADV Mesa 26.2.4, Linux
  • AI-assisted: yes

@JJenkx
JJenkx marked this pull request as ready for review October 14, 2026 17:38
@github-actions github-actions Bot added prx Other PRX libraries docs Documentation labels Oct 14, 2026
@JJenkx JJenkx closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation prx Other PRX libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant