mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-04 07:18:50 +00:00
pool_tasks_test stalled on boston (i9-13900K) and sometimes on p1004: "the CPU expert pool stalled after a phase (N-1 of N workers parked)", abort after 60 s; 12 of 12 runs here.
The stall report now shows what was missing before (the pool's own diag(): every worker's state, the host's, the batch counters and mode; the Linux thread table; and, with glibc, a call stack of every pool thread, resolved with addr2line). It showed one worker, always spinning, always inside ExpertPool::prefetch_task.
Cause: prefetch_next() publishes a per-worker batch that nobody waits for ("the next batch of any kind stops it", wait_parked). A worker that slept through that publish still counts as parked, so the host's next wait_parked passed at once, cleared the abort flag and went on. The late worker then woke for the stale prefetch, entered its all-workers barrier (pf_arrive_ < W) with nobody left to arrive and no abort flag set, and spun for ever; the host waited for it to park, and the batch counters of the next phase were disturbed (done_ above the task count).
Fix: every worker records the epoch it last finished (wack_), and while a prefetch is in flight wait_parked also waits until all of them have finished the prefetch's epoch. The abort flag stays set meanwhile, so a late worker leaves the prefetch at its next check. Nothing changes for batches without a prefetch.
pool_tasks_test on boston: before 12 of 12 aborted (60 s); after 10 of 10 passed in 7.8 s.