Skip to content

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

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

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

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

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

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: #6000 parks the guest audio calls at exit and waits for them to leave before the static destructors run, so the port table no longer needs process lifetime. If the crash at exit still shows on main with #6000, please reopen with the stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants