nkwebkit_jsctimelimit is flaky on Windows: JscTimeLimit check failed at line 260 #26039

Closed
opened 2026-11-23 05:05:40 +00:00 by aKazm1 · 0 comments
aKazm1 commented 2026-11-23 05:05:40 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by aKazm1 on 2026-11-23T05:05:40Z.


What happens

nkwebkit_jsctimelimit fails about 1 run in 7 on Windows with JscTimeLimit check failed at line 260. The process exits with 0xc0000409.

Title, test or build step

ctest nkwebkit_jsctimelimit

AnyPS5 commit

main 742022e89d, with no pull requests on top. origin/main b51f99a5aa has no commit touching JscTimeLimit.cpp or WtfCpuTime.cpp since then.

System

  • OS: Windows 11 Pro 10.0.26200
  • CPU: AMD Ryzen 9 7900X (12C/24T)
  • Toolchain: WinLibs GCC 15.2.0 UCRT r7, Release
  • The test does not use the GPU. The same rate shows with ANYPS5_GPU set to either the RTX 4080 or the Radeon iGPU.

Steps to reproduce

ctest --test-dir build -R "^nkwebkit_jsctimelimit$" -j1 --output-on-failure

Each run takes about 3 s. Repeat it about 10 times to see a failure.

Log

1/1 Test #5017: nkwebkit_jsctimelimit ............Exit code 0xc0000409***Exception:   3.29 sec
JscTimeLimit check failed at line 260

What was checked

  • Failure rate: 3 of 20 solo runs, and 1 of 4 in an earlier set. It also failed once in a full-suite run (ctest -j 12).

  • The failing check, in TestTimeSpentWaitingIsNotCounted, core/libs/prx/libSceNKWebKit/tests/JscTimeLimit.cpp:260:

    JSContextGroupSetExecutionTimeLimit(f.group, 0.05, nullptr, nullptr);
    const double processorBefore = ProcessorSeconds();
    start = Clock::now();
    Require(Eval(f.ctx, "nap(); var turns = 0; while (turns < 100000000) { turns++; } turns") == nullptr);
    Require(ProcessorSeconds() - processorBefore >= 0.05);                 // line 259 passes
    Require(Clock::now() - start >= nap + std::chrono::milliseconds(50));  // line 260 fails
    
  • What this implies: line 259 passes, so the thread was charged at least 50 ms of CPU time. Yet less than 400 ms + 50 ms of wall time passed since start. So either the thread CPU time (WTF::CPUTime::forCurrentThread, which reads clock_gettime(CLOCK_THREAD_CPUTIME_ID)) runs ahead of the wall clock, or the 400 ms sleep_for in nap() returns early as measured by Clock. I have not measured which one.

  • Clock source: on this host the guest CLOCK_THREAD_CPUTIME_ID goes through the invariant-TSC path in libkernel/Time/Time.cpp (QueryThreadCycleTime divided by HostTscFrequency_nid_no_patch()).

  • Searched issues and PRs for jsctimelimit, JscTimeLimit and line 260, and found none.

AI-assisted: yes (Claude Code ran the test loops and drafted this report; I reviewed it and the results are from my machine.)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6552678374 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/26039). Originally posted by [aKazm1](https://github.com/aKazm1) on 2026-11-23T05:05:40Z. --- ### What happens `nkwebkit_jsctimelimit` fails about 1 run in 7 on Windows with `JscTimeLimit check failed at line 260`. The process exits with `0xc0000409`. ### Title, test or build step ctest `nkwebkit_jsctimelimit` ### AnyPS5 commit `main` 742022e89d, with no pull requests on top. `origin/main` b51f99a5aa has no commit touching `JscTimeLimit.cpp` or `WtfCpuTime.cpp` since then. ### System - **OS:** Windows 11 Pro 10.0.26200 - **CPU:** AMD Ryzen 9 7900X (12C/24T) - **Toolchain:** WinLibs GCC 15.2.0 UCRT r7, Release - The test does not use the GPU. The same rate shows with `ANYPS5_GPU` set to either the RTX 4080 or the Radeon iGPU. ### Steps to reproduce ``` ctest --test-dir build -R "^nkwebkit_jsctimelimit$" -j1 --output-on-failure ``` Each run takes about 3 s. Repeat it about 10 times to see a failure. ### Log ```text 1/1 Test #5017: nkwebkit_jsctimelimit ............Exit code 0xc0000409***Exception: 3.29 sec JscTimeLimit check failed at line 260 ``` ### What was checked - **Failure rate:** 3 of 20 solo runs, and 1 of 4 in an earlier set. It also failed once in a full-suite run (`ctest -j 12`). - **The failing check**, in `TestTimeSpentWaitingIsNotCounted`, `core/libs/prx/libSceNKWebKit/tests/JscTimeLimit.cpp:260`: ```cpp JSContextGroupSetExecutionTimeLimit(f.group, 0.05, nullptr, nullptr); const double processorBefore = ProcessorSeconds(); start = Clock::now(); Require(Eval(f.ctx, "nap(); var turns = 0; while (turns < 100000000) { turns++; } turns") == nullptr); Require(ProcessorSeconds() - processorBefore >= 0.05); // line 259 passes Require(Clock::now() - start >= nap + std::chrono::milliseconds(50)); // line 260 fails ``` - **What this implies:** line 259 passes, so the thread was charged at least 50 ms of CPU time. Yet less than 400 ms + 50 ms of wall time passed since `start`. So either the thread CPU time (`WTF::CPUTime::forCurrentThread`, which reads `clock_gettime(CLOCK_THREAD_CPUTIME_ID)`) runs ahead of the wall clock, or the 400 ms `sleep_for` in `nap()` returns early as measured by `Clock`. I have not measured which one. - **Clock source:** on this host the guest `CLOCK_THREAD_CPUTIME_ID` goes through the invariant-TSC path in `libkernel/Time/Time.cpp` (`QueryThreadCycleTime` divided by `HostTscFrequency_nid_no_patch()`). - Searched issues and PRs for `jsctimelimit`, `JscTimeLimit` and `line 260`, and found none. AI-assisted: yes (Claude Code ran the test loops and drafted this report; I reviewed it and the results are from my machine.)
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#26039
No description provided.