ReviewOS

zig-utils/zig-js

Test: make shared GC attribution witnesses stable under full unit sharding

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

Parent: #476. Related: #673 and #838 (observed while validating that compiler fix; no affected loop/suspension test failed in these runs).

Two consecutive zig build test-parallel runs on current main plus the #838 candidate each accounted for all 2,233 tests with 2,231 pass / 1 skip / 1 failure, but the single failure moved between unrelated GC-attribution witnesses:

  1. parallel_js: cooperative shared nursery rendezvous bounds object churn
    • failed only because ctx.gc_cooperative_attempts == 0
    • all JS work completed; no crash, race report, leak, or wrong result
    • immediately passed 3/3 when run with the exact test filter
  2. enable_gc: requested GC runs between microtasks after joined threads
    • failed because the final collected witness was not true
    • immediately passed 3/3 when run with the exact test filter

The earlier full run before the final storage-policy correction passed both of these witnesses and instead caught the now-fixed loop/suspension regressions, so neither predicate is deterministically broken by #838. The failures appear only under the full 10-shard load and move between collection-attribution boundaries.

Diagnose why the requested/cooperative collection can complete the workload without recording the expected witness under sharded load. Preserve the production tranche, collection requirements, and exact assertions: no sleeps, larger timeouts, forced extra drains/collections, relaxed predicates, disabled GC, or shard serialization. The test should observe the engine's real request/attempt publication deterministically, and the engine should make progress if the missing event is genuine.

9 days ago

Landed on main in 0b6f4d96.

Two independent causes were corrected:

  • synchronous Thread.join now remains parked until the worker has left its active interpreter and native stack; result publication alone no longer lets join return while Context GC must still treat the thread as live
  • the cooperative nursery witness now has either lane independently cross the unchanged 512 KiB tranche while its peer remains registered, making the existing attempt/collection/peer-park assertions scheduler-independent

No sleeps, larger timeouts, forced collections, relaxed predicates, disabled GC, or shard serialization were added.

Validation:

  • cooperative nursery witness: 10/10
  • requested microtask GC after join: 10/10
  • all 11 join-focused unit tests: pass
  • the same 11 tests under unsuppressed TSan: pass, no sanitizer report
  • full test-parallel: 2,232 passed, 1 skipped, 0 failed, 0 leaked across 10 shards

Thread is a non-standard host API, so test262 is not applicable to this change.

Sign in to comment on this issue.