test(libc): keep macOS write watch stress bounded #2846

Merged
MarcZX10 merged 1 commit from upstream-pr/2846 into main 2026-10-10 22:58:50 +00:00
MarcZX10 commented 2026-10-10 16:29:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T16:29:52Z.


What

Keep the macOS write-watch thread stress test below the 30-second CI limit. The test polls and recollects all watched pages in a tight loop while four writer threads run. Reduce the stress loop from 200 rounds to 50 and yield between collections so the writers can make progress under contention. The four writers, concurrent collection, and final-write assertions remain covered.

This is a follow-up to the unrelated timeout seen in #2819. The same write_watch_threads timeout also appeared in another PR run, while the corresponding macOS arm64 job passed.

Tested

  • python3 tools/check_conventions.py --base upstream/main passed.
  • git diff --check passed.
  • The test is macOS-only and cannot run on this Linux environment; macOS CI is needed to validate the change.

Checklist

  • Based on current main; no open PR implements this test adjustment
  • One topic
  • No comments added to code
  • No investigation files added
  • No third-party code added
  • Depends on: none
  • AI-assisted: yes (Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4812736353 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2846). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T16:29:52Z. --- ### What Keep the macOS write-watch thread stress test below the 30-second CI limit. The test polls and recollects all watched pages in a tight loop while four writer threads run. Reduce the stress loop from 200 rounds to 50 and yield between collections so the writers can make progress under contention. The four writers, concurrent collection, and final-write assertions remain covered. This is a follow-up to the unrelated timeout seen in #2819. The same `write_watch_threads` timeout also appeared in another PR run, while the corresponding macOS arm64 job passed. ### Tested - `python3 tools/check_conventions.py --base upstream/main` passed. - `git diff --check` passed. - The test is macOS-only and cannot run on this Linux environment; macOS CI is needed to validate the change. ### Checklist - [x] Based on current `main`; no open PR implements this test adjustment - [x] One topic - [x] No comments added to code - [x] No investigation files added - [x] No third-party code added - [x] Depends on: none - [x] AI-assisted: yes (Codex)
Bruggi-ch commented 2026-10-10 20:17:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Bruggi-ch on 2026-10-10T20:17:12Z.


Measured on a MacBook Air, Apple M5 (10 cores, on AC power), macOS 27.0.1, x86-64 under Rosetta, built as in BUILD.md ("Write watch tests", -DCMAKE_OSX_ARCHITECTURES=x86_64). main at 1476f769 against this PR at f907365f. I ran write_watch_tests threads directly, 20 runs per variant, alternating.

Without load:

  • main: median 6.78 s, range 4.02 to 10.58 s, 0 failed.
  • PR: median 0.26 s, range 0.25 to 0.56 s, 0 failed.

With 10 busy yes processes (one per core):

  • main: 12 of 20 runs reached my 60 s cutoff, the fastest took 39.04 s. Every run exceeded 30 s.
  • PR: median 2.68 s, maximum 6.87 s, 0 failed.

All five write watch tests pass with the PR (ctest, 0.33 s). The PR changes both the round count and adds yield(); I did not measure them separately. One PR run under load took 0.02 s and I could not explain it. The load is artificial and the 60 s is my own cutoff, not the true duration on main.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101760336 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2846#issuecomment-6101760336). Originally posted by [Bruggi-ch](https://github.com/Bruggi-ch) on 2026-10-10T20:17:12Z. --- Measured on a MacBook Air, Apple M5 (10 cores, on AC power), macOS 27.0.1, x86-64 under Rosetta, built as in BUILD.md ("Write watch tests", `-DCMAKE_OSX_ARCHITECTURES=x86_64`). `main` at `1476f769` against this PR at `f907365f`. I ran `write_watch_tests threads` directly, 20 runs per variant, alternating. Without load: - `main`: median 6.78 s, range 4.02 to 10.58 s, 0 failed. - PR: median 0.26 s, range 0.25 to 0.56 s, 0 failed. With 10 busy `yes` processes (one per core): - `main`: 12 of 20 runs reached my 60 s cutoff, the fastest took 39.04 s. Every run exceeded 30 s. - PR: median 2.68 s, maximum 6.87 s, 0 failed. All five write watch tests pass with the PR (`ctest`, 0.33 s). The PR changes both the round count and adds `yield()`; I did not measure them separately. One PR run under load took 0.02 s and I could not explain it. The load is artificial and the 60 s is my own cutoff, not the true duration on `main`. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-10 20:19:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T20:19:49Z.


Thanks for measuring both versions on the same Mac and reporting the loaded and unloaded runs. The large reduction in runtime supports the change; I agree the yes workload is an artificial stress case, so I’ll treat those figures as evidence of worst-case headroom rather than typical runtime.

I rebased the PR onto current main. The earlier macOS CI run passed, and this update will trigger a fresh run against the current base.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101783220 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2846#issuecomment-6101783220). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T20:19:49Z. --- Thanks for measuring both versions on the same Mac and reporting the loaded and unloaded runs. The large reduction in runtime supports the change; I agree the `yes` workload is an artificial stress case, so I’ll treat those figures as evidence of worst-case headroom rather than typical runtime. I rebased the PR onto current `main`. The earlier macOS CI run passed, and this update will trigger a fresh run against the current base.
adriadam10 commented 2026-10-10 22:58:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:58:47Z.


Checked the diff (rounds 200 → 50, yield() between collections; the four writers, concurrent Collect and the final == Rounds assertion are kept). macOS write-watch jobs (macos-15, macos-15-intel) are green on this head, and @Bruggi-ch's measurements on Apple M5 show 6.78 s → 0.26 s unloaded and no more 30 s timeouts under load. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103091828 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2846#issuecomment-6103091828). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T22:58:47Z. --- Checked the diff (rounds 200 → 50, `yield()` between collections; the four writers, concurrent `Collect` and the final `== Rounds` assertion are kept). macOS write-watch jobs (macos-15, macos-15-intel) are green on this head, and @Bruggi-ch's measurements on Apple M5 show 6.78 s → 0.26 s unloaded and no more 30 s timeouts under load. Merging.
Sign in to join this conversation.
No reviewers
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!2846
No description provided.