ReviewOS

zig-utils/zig-js

GC: make multi-age cooperative nursery witness drive its collection precondition

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

Problem

context.test.parallel_js: multi-age cooperative nursery retains old-owner graph assumes one fixed 6,000-iteration allocation batch always completes at least the three successful cooperative collections required by the configured tenuring age.

Under a loaded 10-shard run, bounded 100 ms rendezvous attempts can time out often enough that the batch finishes with fewer than three successful collections even though the graph and terminal accounting remain correct:

src/context.zig:41475: collections >= runtime_gc_tenuring_age
full gate: 2,582 passed, 1 skipped, 1 failed, 0 leaked

An immediate isolated rerun passed in 1.423 s. The scheduler change in #1040 is inert in this witness because two workers fit below the automatic runnable-slot limit and no slot waiter exists.

Definition of done

  • The witness drives bounded additional allocation batches until it actually observes the configured number of successful cooperative collections.
  • Each batch preserves the old-owner child and exact worker result.
  • The retry bound fails normally if the collector cannot make progress.
  • Collection/timeout terminal accounting and promotion assertions remain exact.
  • Repeated focused runs and the full sharded unit suite pass with zero failures and leaks.
9 days ago

Fixed and pushed to main in f9ed7030.

The witness now runs bounded identical allocation batches until it observes the configured three successful cooperative nursery collections. Every batch verifies the old-owner child and exact worker result; the existing collection/timeout accounting, promotion, survivor, and terminal-state assertions remain intact.

Evidence:

  • 20/20 focused normal repetitions pass;
  • focused unsuppressed TSan passes;
  • final full unit gate: 2,583 passed, 1 skipped, 0 failed, 0 leaked in 561.9 s.

Sign in to comment on this issue.