ReviewOS

zig-utils/zig-js

Mid-GC: synchronize timeout-root release with the parked sweep

#1108
Closed chris opened this 9 days ago ·
9 days ago

Related: #1106; found during its unchanged full mid-GC qualification.

The corrected candidate's 900-program profile reports one failure at seed 1: midgc sync-timeout cleanup fired while timeout peers were parked. Both isolated parent/candidate seed replays pass.

An executed diagnostic built from parent 969c0f5c preserves worker counts, timer values, allocation rounds, and spin work, and adds completion counters plus a controlled main-thread pause of the worker timeout + 100 ms. It reproduces the assertion with:

completed=7; timeout-ms=1118; elapsed-ms=1533

The counter increments after each worker clears both target references. All seven workers have legitimately timed out and released their targets, so the assertion's assumption that they remain parked with live targets no longer holds. This diagnostic does not establish an early-finalization engine defect.

Replace the wall-clock ownership assumption with an explicit phase: retain each timeout target until main publishes completion of the parked-root GC sweep. Keep the original timers and work; verify timed-out results, condition predicate calls, token reacquisition/unlock, join sums, collection attempts/completions, and exact eventual cleanup counts/sums. The root-retention wait must be predicate-driven, without sleeps or polling timeouts.

Acceptance: the controlled parent diagnostic exposes the old assumption; the corrected fixture retains every original oracle in Debug/ReleaseSafe/unsuppressed TSan; the full unchanged 900-program mid-GC inventory passes without exclusions or relaxed budgets.

9 days ago

Landed on main in 1f53d08.

Timeout workers now retain targets through an explicit predicate-driven release phase, and revalidate roots after main completes the parked sweep. Original timers, workload, timeout results, predicate/token checks, collection attempts/completions, join sums and exact eventual finalization counts/sums remain intact.

Executed before diagnostic on the parent: all 7 workers legitimately released targets after timeout1118 ms; main asserted at1533 ms. The corrected fixture passes that same controlled pause/workload. Focused checks pass Debug2 seeds, unsuppressed TSan2 seeds, ReleaseSafe20 seeds; full candidate mid-GC passes900/900 with the unchanged CI watchdog and no exclusions.

Combined engine qualification passes272/272 optimizer/for-in tests in Debug/ReleaseSafe/unsuppressed TSan, exact-parent7980 conformance cases per execution mode unchanged, and full no-GIL253/253 in Debug and ReleaseSafe. The parent full mid-GC control has8 separate late-asyncJoin finite-wait failures, with passing focused parent/candidate controls; those are retained in #1109, cause undetermined. The corrected sync-timeout fixture does not fail in that parent inventory.

Sign in to comment on this issue.