Repository navigation
fix(agc): keep capture trace output nonfatal - #10760
oneandonlydean merged 5 commits into
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
The happy-path backpressure test is useful, and I verified that the worker’s 100 ms timed wait drains a full queue even when it is below the normal 64 KiB notify threshold. I found an unhandled writer-error path in the new wait protocol:
run()swapspendingintobatchand notifiesspaceAvailable.- A waiting producer wakes and can fill
pendingback to the limit. - If
output.write()oroutput.flush()then throws, the catch callsstd::terminate()and the worker exits without notifyingspaceAvailableagain. - The producer’s predicate only checks queue size, so it can remain blocked forever; the destructor can also wait indefinitely if this occurs during shutdown.
The PR says file-write errors retain their existing behavior, but the new condition-variable wait adds a stranded-waiter case on that existing fatal path. Please either make writer failure a synchronized terminal predicate that wakes all waiters (and ensure shutdown handles it consistently), or demonstrate with a deterministic failing stream test that this state cannot occur. Please add a focused regression for writer failure; the current test only exercises a recovering sink. I have not modified your branch.
|
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 Thanks for asking for this check. I added write-failure and flush-failure tests in 58afe45. Each test holds the writer, fills the queue, starts four producers, and checks that none can finish. It then makes the stream return a short write or a failed flush. To pass, the child must reach the real writer catch, call the saved original terminate handler, and exit with the same result as an abort control. A random crash or timeout does not count. All 11 capture-trace tests pass locally on Windows, and both new cases passed 10 consecutive runs. I also tried a temporary copy where the catch returns instead of calling terminate: both tests failed through the watchdog, with the producers still waiting. One clarification: There is a coverage limit: these are host-runtime component tests using the production header. With the project's current Windows This investigation and the new tests were AI-assisted with Codex. |
MarcZX10
left a comment
There was a problem hiding this comment.
Rechecked exact head 58afe4560099d805edf020ae603e84a5fec063d6. The added writer-failure tests address the stranded-producer concern: they fill the bounded queue, verify four producers remain blocked, then trigger both a short write and a failed flush through the production CaptureTrace::run() catch and require the saved terminate handler to abort. The fixture distinguishes setup failure, watchdog exit, handler return, and the abort control result. The PR also clearly limits this evidence: the failure target uses the host C++ runtime; the separate probe with the project's Windows libc did not reach the catch, and that path is not claimed as covered.
I independently compiled CaptureTrace.cpp and CaptureTraceFailure.cpp from this exact head on Linux with g++ -std=c++20 -Wall -Wextra -Werror -pthread. The queue-backpressure case passed, and the CMake failure harness passed both write and flush modes. tools/check_conventions.py --base upstream/main --head upstream/pr/10760 and git diff --check pass. Hosted conventions and labels pass; the product build/test jobs are skipped by path filters, so I am not claiming hosted product coverage. The author reports the full Windows library/relinker builds and focused Windows suite in the PR description.
Independently checked hosted evidence — 28 October 2026I checked the eligibility log: this run selects only #10760 at
This is an independent inspection of the hosted logs, not a new local execution, full green CI, GPU/Sonic validation or performance measurement. It supersedes the request for a first new hosted run, while retaining the unsuccessful overall Windows result. The maintainer's drop-and-count/nonfatal-writer contract is settled; #10760 remains the proposed fix and the issue remains open pending merge. AI-assisted:yes(Codex). Earlier standalone validation, at its original proposal/headIndependent synthetic validation of
I compiled your pinned public header/fixtures as standalone host-runtime executables, with no AnyPS5 replacement libc or driver linkage. Scratch files were on our NAS, but the paused/failing sinks are synthetic buffers: this is not an SMB-throughput test, full configured PR build, game/GPU validation, or approval of the logging policy. Your documented possibility of stalled callers/shutdown remains a maintainer decision in #10753. No composition branch was changed for this check. AI-assisted: yes (Codex). |
|
@lgqdaxia #11157 (Linux frame capture) and this PR touch the same spot in I'm happy with either order: whichever merges second rebases and keeps both entries (yours first, then the rewritten "Frame capture" one). No Unrelated small thing I noticed while reading it: the entry is followed by an empty line, which splits the Functional list in two when rendered. |
|
Agreed, @janzezno. I checked #11157's changed files and patches: the production changes are independent, and the CMake test additions are in separate sections. Let's keep both PRs independent, with no I also removed the extra blank line in AI-assisted: Codex |
|
@lgqdaxia Thanks for picking this up. I've answered the policy question on #10753: a trace must never stop or stall the program, so when the queue is full it should drop new records and count them rather than wait. Could you change the PR to:
The queue limit can stay as it is. |
29c4b17 to
efb3dc3
Compare
Follow the capture policy requested in boykopovar#10753 and boykopovar#10760. Keep queue callers running, record loss markers and totals, and disable failed output without relying on stream exceptions. AI-assisted: Codex
|
@oneandonlydean Updated in The queue now drops new records and counts them. When the writer resumes, the trace gets a Write and flush errors now stop tracing and log one error instead of terminating the process. I changed this to direct stream-state checks, so it does not need the exception path that had limited the earlier Windows tests. Both failures now pass with the host runtime and the project's own Windows libc, including later calls doing no more output and normal destruction. Full Windows library/relinker builds and 18 selected checks pass. Linux actual-header host components pass 14/14, plus a real AI-assisted: Codex |
|
@lgqdaxia Thanks for the drop-and-count rework. CI on The four The branch also conflicts with |
efb3dc3 to
48f7852
Compare
Follow the capture policy requested in boykopovar#10753 and boykopovar#10760. Keep queue callers running, record loss markers and totals, and disable failed output without relying on stream exceptions. AI-assisted: Codex
|
@oneandonlydean Thanks, you're right. The fixtures ran locally, but I had missed running the registration audit. Fixed in I reproduced the two registration errors before the change. After reconfiguring, the full Windows build's registration audit reports 1383 test executables, 0 unregistered. Rebuilt the three capture targets and their dependencies; all 16 capture CTests pass, including all four host/project-runtime write/flush cases. On WSL Linux, the actual source and wrapper also pass both host failure tests with a spaced output path; this is component coverage, not a full Linux product build. Rebased onto main AI-assisted: Codex |
|
@oneandonlydean Following up on Build 40458520694: Linux and Windows both passed the registration audit, completed the product compilation and Both jobs failed the same public-header declaration audit, leaving 64 dependent checks per platform not run. The same failure reproduces on the unmodified tested main #11718 has since fixed that duplicate declaration. The source-only audit passes on main If another run is not already queued, could you start a new full CI run on this head against the fixed main when capacity allows? AI-assisted: Codex |
|
@oneandonlydean Rebased onto main The manual conflicts were only in the debt file. Both the updated Linux frame-capture entry and our trace-output entry are retained. The capture header, C++ fixtures and failure wrapper are unchanged from On the rebased Windows project configuration, the registration audit passes; all three capture targets build, and 16 capture tests plus the public-header audit pass (17/17). The public-header audit took 60.78 s locally. A separate CPU-only host comparison passes the same eight common tests on main and the change. These checks do not establish a full product build, GPU/game validation or a new hosted CI pass. I've updated the PR's validation summary and kept the previous hosted results clearly marked as historical. If a run on this new head is not already queued, could you start a new full CI run when capacity allows? AI-assisted: Codex |
Follow the capture policy requested in boykopovar#10753 and boykopovar#10760. Keep queue callers running, record loss markers and totals, and disable failed output without relying on stream exceptions. AI-assisted: Codex
|
@oneandonlydean Following up on Build 40572948350, which has now finished on current head
The earlier run 40528015978 has the same diagnostic; I checked its eligibility log and it selects only #10743, without this PR. This matches the symptom described in the existing #12069 Windows thread-exit fix proposal. I have not locally reproduced that race or tested #12069, so I am not claiming that proposed fix or a combined stack is validated. I have updated the PR's validation summary and left the capture branch unchanged. The overall Build remains failed; the skipped checks and passing capture tests are not a full CI or GPU/game pass. AI-assisted: Codex |
|
@oneandonlydean The Windows thread-exit fix in #12069, which targets the diagnostic seen in Build 40572948350, has now merged into main as Our capture head is unchanged at AI-assisted: Codex |
|
@oneandonlydean @lgqdaxia, a Windows run of this head on Windows 11 26220, Ryzen 7 5800X, RTX 3080, WinLibs GCC 15.2, Release, full builds with submodules at their pinned commits, validation layers on,
AI-assisted: yes (Claude Code) |
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (8, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 422 tests)Skipped (42)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
c4ad483 to
6d26a5b
Compare
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The exact head bounds capture-trace queue growth, records losses in order, and disables tracing after output failures; the relevant focused tests are registered, and I found no blocking issue.
What I ran
Reviewed head 6d26a5b8ebaa75a2e3c517c809ea045b1b6b47b4. The PR's API base is 684dfc1d561d09a8c35c7c153c95bcfed7e49896; a merge preview against current main 6190e0efeb2e686e763a00518547b593f23ff163 was clean. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0. No build or C++ test binary was run locally.
git diff --check 684dfc1d561d09a8c35c7c153c95bcfed7e49896...6d26a5b8ebaa75a2e3c517c809ea045b1b6b47b4
python3 tools/check_conventions.py --base 684dfc1d561d09a8c35c7c153c95bcfed7e49896 --head 6d26a5b8ebaa75a2e3c517c809ea045b1b6b47b4
python3 tools/pr_stack_check.py 10760 --repo boykopovar/AnyPS5
python3 tools/pr_test_quality.py --root /marc/AnyPS5 --json core/libs/prx/libSceAgcDriver/tests/CaptureTrace.cpp core/libs/prx/libSceAgcDriver/tests/CaptureTraceFailure.cmake core/libs/prx/libSceAgcDriver/tests/CaptureTraceFailure.cpp core/libs/prx/libSceAgcDriver/tests/cmake/agc_capture_trace_tests.cmakeResults
| Check | Result |
|---|---|
| Diff and conventions | Passed. |
| Current-main merge preview | Clean; no declared dependency. |
| Test registration and assertions | The heuristic flagged two C++ test paths because it searches for literal source paths. I verified the fragment is included through the tests/cmake/*.cmake CMake glob and registers both executables; queue tests check bounds, loss counts, record ordering, recovery and shutdown. |
| Hosted CI | Current-head conventions and labels checks pass. No product build/test job is present in the hosted snapshot. |
| Focused Windows validation | The PR description reports the three capture targets built and 17/17 capture/header CTests passed on this head; it also reports eight common capture tests passing on both main and this head. These are author-reported, not runs I independently performed. |
| Precheck helper availability | The precheck's isolated snapshot did not contain workspace-only pr_abi_audit.py and pr_test_quality.py; those two helper invocations failed to start. ABI auditing is not applicable to these non-export changes. |
Test-quality heuristic output
{
"findings": [
{
"path": "core/libs/prx/libSceAgcDriver/tests/CaptureTrace.cpp",
"line": 1,
"kind": "possible-unregistered-cpp-test",
"message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
},
{
"path": "core/libs/prx/libSceAgcDriver/tests/CaptureTraceFailure.cpp",
"line": 1,
"kind": "possible-unregistered-cpp-test",
"message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
}
],
"negative_control_candidates": [],
"limits": [
"Heuristics can miss weak assertions and can flag valid tests; inspect every finding.",
"A test that passes against base is not by itself proof that the PR test is inadequate.",
"Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."
]
}
Sources
- Queue drop policy and writer failure handling at this head
- Queue-loss and ordering assertions at this head
- CMake test-fragment registration at this head
Not verified
I did not build locally or run the C++ tests, and did not independently verify Linux/macOS, GPU, or console behavior. The author-reported Windows and paired common-test results above remain unverified by me.
✅ NVIDIA GPU test: passedPR head
Intermittent validation messages (1, seen once in the parallel run, not reproduced when the test was re-run alone 2 times; not counted against this PR)Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validation IDs already present on main (5 IDs in 486 tests)Skipped (44)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
Wait for the writer to take a batch instead of throwing when the pending queue is full. Add a controlled-sink test with four producers and check that records stay complete and ordered. AI-assisted: yes
Remove the extra blank line between capture trace output and frame capture. The independent changes in boykopovar#11157 may merge in either order; the second branch keeps both entries when rebasing. AI-assisted: Codex
Follow the capture policy requested in boykopovar#10753 and boykopovar#10760. Keep queue callers running, record loss markers and totals, and disable failed output without relying on stream exceptions. AI-assisted: Codex
6d26a5b to
b2ab7b2
Compare
✅ NVIDIA GPU test: passedPR head
Intermittent validation messages (1, seen once in the parallel run, not reproduced when the test was re-run alone 2 times; not counted against this PR)Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (4, not counted against this PR)Validation IDs already present on main (5 IDs in 484 tests)Skipped (46)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
What
Capture tracing can throw when its 16 MiB pending queue fills, or stop the process when file output fails. This implements the drop-and-count policy requested in #10753.
capture-trace-dropped records=N; normal shutdown writescapture-trace-summary dropped=N. Accepted records and loss markers keep their order. After a drop, new records remain rejected until the next drain.This rebase resolves a context conflict in the technical-debt list and retains both the new upstream entry and this PR's trace-output limitation. The capture header, both C++ fixtures, failure wrapper and
tests/cmake/agc_capture_trace_tests.cmakeare byte-identical to previous published head6d26a5b8eb. All five topic commits are retained; the production behavior is unchanged. The AGC root CMake file and all upstream debt content are retained.AI-assisted: Codex
Tested
Current local validation is for head
b2ab7b2dc61b35a3b2db107341b3c4ef624fbe9d, based on maine53aff3f560e05730a608f7fb3084f2010abfacb.BUILD_TESTING=ON.tools/check_test_registration.pypasses, checking 1,694 test executables. Built all three capture-trace targets and their dependencies, including the project'slibc.public_headerspass (17/17), zero skipped. This includes host-runtime and project-runtime write/flush failure cases. Total CTest time was 44.42 s. This is a focused build/test run, not a full product build or complete CTest suite. These CPU fixtures do not initialize Vulkan; no GPU execution or performance result is claimed.6d26a5b8ebaa75a2e3c517c809ea045b1b6b47b4. Removing this PR's single trace-output debt entry reproduces main's debt file byte-for-byte. Conventions, whitespace checks and a merge-tree check against the stated main pass.The earlier isolated host-runtime comparison remains pinned to main
9fe758d7520eb0c33f3df8bef539064b40bd523fand head6d26a5b8eb: eight common capture tests passed 8/8 on each. That is historical comparison evidence, separate from the current configured project-runtime tests above.Historical hosted evidence remains pinned to its original versions: Build 40572948350 tested old head
c4ad483347merged into maind13b3d7c55. Both platforms built the product/libraries and passed all 16 capture tests. Linux recorded 2483 passed / 97 skipped; Windows recorded 1848 passed / 832 skipped / 1 failed (guest_raise_exception). The overall run failed.The independent Windows comparison and NVIDIA contributor report in this discussion also concern old head
c4ad483347. They are not new-head validation or full upstream CI approval. No full hosted CI, new Linux/macOS runtime, game capture, real SMB throughput or cancellation of permanently blocked native I/O is claimed for this rebase.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)