test(avplayer): guest_avplayer fails intermittently in full builds (Linux and Windows) #2709
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T11:51:04Z.
guest_avplayerfails intermittently in the full build, on both Linux and Windows, on a commit that doesn't touch libSceAvPlayer.Seen while building #2661 (
workflow_dispatch -f pr=2661), whose change is limited to libSceAgcDriver and the shader recompiler:core/libs/tests/GuestAvPlayer.cpp:724,enable video failed.Subprocess abortedafter 1.55 s. The test'sstd::abort()calls are in the allocator and event callbacks (lines 507 and 552).guest_avplayer_testslinks onlylibSceAvPlayerandlibc. Locally (Linux, RADV and lavapipe) it passed 6 runs out of 6 on the same tree, so it looks timing-dependent. Recent libSceAvPlayer changes on main include068da6a99(skip late video frames in no-sync mode while audio drives the clock).AI-assisted: yes (Claude).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T12:08:02Z.
I traced the
enable video failedpath on currentmain.FfmpegSource::EnableStreamreturnsfalseonly when the index is out of range orstartedis already true. This test verifies that there are three streams and that indexVideoStreamis the video stream, then callsEnableStream; its first explicitsceAvPlayerStartis later, after both stream enables. Because the test supplies an event callback,Playershould also have auto-start disabled. This is source-level narrowing, not a reproduction: the Windows report therefore points to the source already being marked started before the explicit start, or to the failing binary/input differing from the reported setup.Could you capture the actual return value from
sceAvPlayerEnableStreamand, if possible, a debugger stack for the Linux abort? The twostd::abortsites in the test are independent checks:Release(around line 507)OnEvent(around line 552)A Linux backtrace (
gdb --batch -ex run -ex bt --args ./guest_avplayer_tests) and the full Windows failure log would separate these paths from theEnableStreamresult. The locally reported 6/6 passes do not yet establish the cause of either CI failure.Imported from boykopovar/AnyPS5. Originally posted by Yuva1024 on 2026-10-10T13:56:53Z.
Reproduced the
enable video failedfailure on Windows and fixed it. Fix:b7dec57aon branchfix/avplayer-unsynced-test-autostartof https://github.com/Yuva1024/AnyPS5 (one file, +2/-1, onmain8b812318). The PR (#2770) was closed automatically by the intake rule; its Conventions check passed.Cause.
TestUnsyncedVideoKeepsUpWithAudiois the only test that callssceAvPlayerEnableStreamby hand on a player created with no event callback (InitData(nullptr)).Playerturns auto-start on in that case (autoStartEnabled = init.auto_start || callback.event_callback == nullptr,Player.cpp:65), so its controller thread runsautoStart(), which enables the streams and callsStart(), shortly afterAddSource. If that lands before the test'sEnableStream,Source::EnableStreamreturns false becausestartedis true (Source.cpp:280). The test thread usually wins; with the CPU busy the controller sometimes does.Measured (Windows 11 26200, WinLibs GCC 15.2.0 r7, Release, Ryzen 5 5600G,
mainba2a0a31):guest_avplayer_tests: 0 of 40 runs fail serially; 1 of 180 fails with six copies running in parallel (enable video failed, exit 1).EnableStream: 10 of 10 runs fail withenable video failed.Eventsobject, so auto-start is off): the same pause gives 10 of 10 passes; at normal timing 460 of 460 pass (100 serial, six loops of 60 in parallel).check_conventions.pypasses, and the fullctestis 709/709.The other four tests without a callback do not call
EnableStream, so they have no such race. This does not account for the Linux abort at the allocator and event callback in the description; I could not test Linux, so that may be the same race showing a different symptom, or a separate cause.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Yassin6up on 2026-10-10T15:01:44Z.
Reproduced and explained the Linux abort.
Reproduction (Linux, Ubuntu 24.04, GCC 13.3, main
8b812318): 8 copies of guest_avplayer_tests in parallel plus 2 busy loops, 22 of 200 runs abort (SIGABRT). gdb shows the abort in _Unwind_RaiseException_Phase2, called from _Unwind_Resume in a landing pad of TestUnsyncedVideoKeepsUpWithAudio. Printing the Check message before the throw shows that all of them are "enable video failed", the same auto-start race as on Windows.Why it aborts instead of printing the message: guest_avplayer_tests imports __cxa_throw and __cxa_begin_catch, and the first library that defines them is libc.prx (loaded before libstdc++), so a failed Check throws through libc.prx's unwinder. But -static-libgcc links a private, hidden copy of _Unwind_Resume into the test, and the landing pad of the test function resumes with it. Phase 2 of that copy cannot continue the unwind that libc.prx's copy started. A forced Check(false) at the start of TestPlayback aborts in the same way every time, while a throw directly in main (no landing pad) is caught and printed. Relinking the test with -shared-libgcc makes _Unwind_Resume resolve to libc.prx too, and the forced failure prints its message and exits with 1.
Fix for the abort: commit
fa5199cd8on branch claude/peaceful-fermat-us6v6j of https://github.com/Yassin6up/AnyPS5 (applies to main8b812318). guest_avplayer_tests is linked without -static-libgcc/-static-libstdc++/-static, as the AgcDriver, Agc and VideoOut test executables already are. Results on Linux:The race itself: Yuva1024's
b7dec57a(event callback in TestUnsyncedVideoKeepsUpWithAudio) also fixes it on Linux: 0 of 240 failures in the same stress run with the static runtime, where unmodified main fails 22 of 200.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:59:47Z.
Fixed in part by #2770: the
enable video failedrace (auto-start vs the test's manualEnableStream); the abort on a failingCheckis still open.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T07:38:13Z.
#4256 is on main. Has
guest_avplayerfailed in a full build since? If not, this can close.Imported from boykopovar/AnyPS5. Originally posted by arreina on 2026-10-14T06:06:21Z.
Data point for closing this: I could not reproduce the intermittent failure on current
main.Stress run (Linux Mint 22.3, GCC 13.3, AddressSanitizer + UBSan build, tree at upstream
77b9f7270with only unrelated fork changes):guest_avplayer_tests1000 times, 8 copies in parallel plus 2 busy loops, the recipe @Yassin6up described above (22 of 200 aborted before the #2770 and #4256 fixes). Result: 0 failures in 1000 runs.One thing to watch for if someone repeats this: the test writes
app0/avplayer.mp4relative to the current directory and truncates it, so parallel copies must each run in their own working directory. With a shared one I got 3 failures in 200 (add source failed), which come from copies overwriting each other's file and are not a player bug.Full CI:
guest_avplayeralso passed in 8 of 8 recent full builds (4 runs, Linux and Windows) on the same tree.So I believe this can be closed.
AI-assisted: yes (Claude).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T06:53:32Z.
Closing as fixed by #2770 and #4256: 1000 stress runs on current main had no failure. If
guest_avplayerfails in a full build again, reopen with the run link.Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-14T08:12:29Z.
@oneandonlydean yes:
guest_avplayerfailed again on currentmain(1209d3707) withenable video failed, on Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, once in four full non-GPUctest -j 16runs (AI-assisted: Claude Code).It is the same auto-start race as before, in a test added after #4256:
TestRestartAfterPausedJumpKeepsClockRunning(from #4652,a671dc4ed) creates the player withInitData(nullptr), soPlayerenables auto-start, and then callssceAvPlayerEnableStreamby hand. When the controller'sautoStart()runs first,EnableStreamreturns an error because the source is already started.Giving it an event callback, as #2770 did for
TestUnsyncedVideoKeepsUpWithAudio, removes the race:Checked the same way as #2770, with a 60 ms sleep inserted before that test's
EnableStream(not part of the fix):guest_avplayerfails 10/10 withenable video failed;Without the sleep, with the change:
guest_avplayerpasses 30/30 (--repeat until-fail:30).cc @xXPBSXx
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T08:59:39Z.
Thanks @simonbronk, your fix is in as #5733: the paused-jump restart test now gets an event callback like the one #2770 added, and it passed 30 runs in a row here.