Repository navigation
fix(agc): do not abort on a screenshot trigger that another process holds open - #20344
oneandonlydean merged 2 commits into
Conversation
When another process holds the APS5_SCREENSHOT_TRIGGER file open on Windows, removing it fails and Screenshot::Take throws, which aborts the title (a bot run ended that way after a screenshot request). The test holds the trigger open, expects Take to return without a request and without throwing, and expects the released trigger to be consumed at the next call. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…xt frame Screenshot::Take threw when removing the APS5_SCREENSHOT_TRIGGER file failed, for example while another process still had it open on Windows, and the throw aborted the title. A removal that fails is now reported once and the trigger is tried again at the next frame; the screenshot is taken once the file can be removed. A trigger that is not a regular file or cannot be inspected still throws. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Evidence for this pull request: the failure from the PPSA15065 run of 2026-11-14 that prompted it, and the output of the two test runs. The first block is the stderr of that run from the line run log, failuretest output, red and greenAI-assisted (Claude Code). |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The changed code handles a trigger removal error by deferring the trigger request and retrying on a later frame; I did not run the reported Windows tests, so the review does not establish that they pass.
What I ran
Inspected head f824cbbbcac1c249917d6817b05d743f5e1f60e8 using the prepared review bundle and pinned repository reader. No test or build command was run.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | All three changed files read |
| Tests and build | not run | Windows results are author-reported |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The reported Windows 10 test runs, Linux and macOS behavior, CI, and a title run were not independently verified. The files read were core/libs/prx/libSceAgcDriver/Execution/src/Screenshot.cpp, core/libs/prx/libSceAgcDriver/tests/Screenshot.cpp, and docs/dev/ENVIRONMENT.md; all three files listed in the manifest as reviewed were read. No changed files were excluded.
To get this to a good state
Nothing is required.
|
A second occurrence in the wild, this time with a likely holder, and a Windows run of this head. Occurrence. and the process ended with exit code
This head on Windows. Head
AI-assisted: yes (runs scripted with an AI assistant, on the hardware above). |
|
Thank you for the second occurrence and for running this head on Windows. The holder. The first report could not say which process held the trigger file. Yours points at the script that creates it: between its create and its close, the file is open without sharing for deletion, and the watched path is looked at in that window. That fits what this change handles: The table. Both columns pass 3/3 on both GPUs. The held-open case is a new case in this pull request's test commit, so the What is not shown. Your title run (PPSA69426) was on AI-assisted (Claude Code). |
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
What
With
APS5_SCREENSHOT_TRIGGERset,AgcDriver::Screenshot::Take()deletes the trigger file to request a PNG of the next presented frame. If the deletion failed, it threw, and the uncaught exception ended the emulator. That happened in a run of PPSA15065 on 2026-11-14: Windows refused the deletion because the file was in use by another process, and the run ended withdriver failure,presentation failedandabort() (SIGABRT)(the first comment has those lines). Which process held the file is not shown by the log.Now a failed deletion is reported once on stderr (
[gpu] screenshot trigger cannot be consumed yet, trying again at the next frame: <system message>) andTake()returns false for that frame. The file stays, the next frame tries again, and the screenshot is taken at the first frame after the other process lets go. The message is printed once until a deletion succeeds (a static flag, cleared after a success), not once per frame. A trigger that cannot be inspected or is not a regular file still throws as before. One clause in theAPS5_SCREENSHOT_TRIGGERrow ofdocs/dev/ENVIRONMENT.mdsays that a trigger another process holds open is retried at the next frame.A trigger that can never be deleted (for example in a directory without write access) is no longer fatal either: it is tried again at every frame, the message is printed once, and no screenshot is taken. This is deliberate, because the trigger is a development aid and a run should not end because of it; it follows from the code, and no such case was run.
The test commit holds the trigger file open without sharing (
CreateFileW, share mode 0) and checks thatTake()does not throw, returns false, and leaves the file; after the handle is closed, the nextTake()returns true and the file is gone. The test is compiled on Windows only: deleting an open file succeeds on POSIX systems, so the case is not reproduced there, and the changed path was not run on Linux or macOS. No title run with this change was made, so the PPSA15065 run is the reason for the change, not a measured improvement.Tested
Windows 10 Pro 10.0.19045, on 2026-11-14 (21:16 UTC and 21:19 UTC). Both runs are on base
upstream/main5cc140af097, which is an ancestor of currentmain(a merge of this branch intomainfca835affc3is clean).ninjareturned 0 for each head before its tests ran. Theagc_screenshotandagc_screenshot_triggertests, the second with the argumenttrigger, are the only ones run; they are in the first comment.agc_screenshotagc_screenshot_triggerThere is no console measurement: the trigger is an emulator development aid with no console counterpart.
tools/check_conventions.py --base 5cc140af097passes. The change is 3 files, +28/-2. GPUs: the two tests only callAgcDriver::Screenshotand the PNG encoder; their source names no Vulkan symbol and the logs contain noSelected GPUline, so no GPU was involved. Not tested: Linux, macOS, the CI runner, a title run with this change, a trigger that stays undeletable, and holding the trigger open by a process other than the test itself.Overlap: the 114 other open pull requests that change one of the three files of this branch (almost all of them through
docs/dev/ENVIRONMENT.md; found by reading the changed files of all 1517 open pull requests at about 00:35 UTC) were test-merged on 2026-11-15 at about 00:38 UTC againstmainef3fafb2269(the branch is based on5cc140af097, which is an ancestor of it); the branch merges into it without a conflict. 61 of them already conflict withmainwithout this change and still conflict with it, 53 merge cleanly with and without it; none conflicts only with this change, so the changed row ofAPS5_SCREENSHOT_TRIGGERindocs/dev/ENVIRONMENT.mdcollides with none. No open pull request changesAgcDriver::Screenshot(Screenshot.cpp,triggered(),Take()) or its test, and none has the screenshot trigger in its title.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)