test(libkernel): fix host-mutex handshake race in guest_raise_exception #1375
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1375"
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 gjonn on 2026-10-08T00:51:07Z.
What
This fixes the flaky Windows ctest
guest_raise_exception. The test sometimes hangs until its 30 s timeout, and the log stops after threeRunThread entry=...lines. It has failed CI on several unrelated branches: #1350, #1354,codex/luna-posix-file-errors,feat/videoout-dcc-visible-keysandperf/shader-bda-span-reads(e.g. job 113079295544).The race is in the test's host-blocked phase. The
sceKernelRaiseExceptiondelivery path from #760 is not affected.hostLock. The worker wakes up insidepthread_mutex_lock, and the redirected handler runs before the worker owns the mutex.ExpectDeliverysees the delivery and returns. Main immediately callshostLock.lock()again.lock_guard. It never setsstartedfor the next round, so main spins forever. A spin is not a failedRequire, so the test never aborts and runs into the ctest timeout instead. The third phase never finishes, which is why the log ends after threeRunThreadlines.The fix: the worker records the round number (
hostAcquired) once it has the mutex, and main waits for it before locking again. The timeout is not changed.Tested
Windows 11, MinGW gcc (posix thread model), Ninja, Release,
BUILD_TESTING=ON.ctest -R guest_raise_exception --repeat until-fail:50passes all 50 runs. The unpatched binary also passed this on an idle machine, so the plain repeat does not hit the race.RunThreadlines, which matches the CI log.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code