Skip to content

fix(videoout): leave a host thread that cannot unwind shutdown - #12113

Closed
wanderingbug wants to merge 1 commit into
boykopovar:mainfrom
wanderingbug:cursor/upstream-macos-exit-e22f
Closed

wanderingbug wants to merge 1 commit into
boykopovar:mainfrom
wanderingbug:cursor/upstream-macos-exit-e22f

Conversation

@wanderingbug

Copy link
Copy Markdown

What

ProcessShutdown thrown on a host thread whose root is thread_start never reaches the catch in Driver::run or the presenter loop. On the confirmed hang, the sync-flip worker was inside FlipRequest::GpuReady, waiting on vblank with cfg->mutex held. A later join, or a frame dump that locks that mutex or the GPU mutex, never returns.

On a thread_start miss the host thread sets hostShutdownAbandoned, logs, and pauses. It does not call _Unwind_ForcedUnwind or pthread_exit. Exit frames are copied while the config mutex is already held. Shutdown dumps that snapshot without taking the config mutex or the GPU mutex, then ends the process before joining the abandoned thread. A guest-frame miss that is not thread_start still runs shutdown and _Exit. LibcTerminate keeps the existing 8 second exit drain and skips the end flush once the flag is set.

Upstream main already includes #11048 (MainThreadMacOs.cpp and OnMainThread in libSceVideoOut) and #7814. This PR sits on that presenter. Open PRs #11447 and #11554 cover macOS compile and Vulkan loader fixes in Lifecycle.cpp and VulkanDevice.cpp, and those hunks are left out of this diff.

Tested

Linux, gcc 13, Release, against upstream main e0cd125. Rebuilt libc, libSceVideoOut, and libSceAgcDriver. Passed exception_runtime, exception_personality, exception_c_cleanup, and video_out_output_mode_policy. python3 tools/check_conventions.py --base upstream/main passed.

Square frame dump and clean exit were confirmed on the combined reference f91b74b, Apple M1 Max, macOS 27, Rosetta 2, MoltenVK 1.4.2.

Checklist

  • Based on current main (e0cd125). Open PRs build(agc): compile Lifecycle, GuestMemory and GuestBufferMemory on macOS #11447 and fix(agc): load the Vulkan loader and list MoltenVK on macOS #11554 edit Lifecycle.cpp and VulkanDevice.cpp for macOS compile and loader fixes; they do not implement this abandoned-thread exit.
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: Apple M1 Max, MoltenVK 1.4.2, macOS 27 (on combined reference f91b74b)
  • AI-assisted: yes

Co-authored-by: devindevsec <devindevsec@users.noreply.github.com>
@github-actions github-actions Bot added the open PR limit Closed over the open PR limit: 1 without merged PRs, 20 with at least 1, none from 20 label Oct 27, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Authors with no pull requests merged into main can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.

@github-actions github-actions Bot closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open PR limit Closed over the open PR limit: 1 without merged PRs, 20 with at least 1, none from 20

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants