ReviewOS

zig-utils/zig-js

GC: make torn-object recovery witness representation-independent

#534
Closed chris opened this 11 days ago ·
11 days ago

Problem

The unit test Context heap_limit_bytes never publishes a torn object under recovery pressure fails on current main after the shape transition representation changed. The 4 MiB cap is reached during the live-hoard fill at 10,018 retained objects, but that OOM is swallowed. The test then requires at least one of 500 smaller post-recovery rounds to OOM; all 500 can now complete after recovery, so the assertion reports failure even though the cap and recovery path were both exercised.

This was found while validating #533 and reproduces on pristine main without that patch. Related historical torn-object issue: #100. The representation change came from the #531 / #478 shape publication work.

Requirements

  • Record the allocation-pressure OOM that actually drives reserveWithRecovery.
  • Require at least one successfully returned post-recovery object and validate all of its fields.
  • Prove that a full collection occurred during the evaluation.
  • Do not require a second OOM whose occurrence depends on object or shape representation size.
  • Keep the heap cap and workload bounded; do not relax engine OOM behavior.

Acceptance

  • The exact focused test passes repeatedly on current main.
  • The test still fails if the pressure fill never reaches the cap, if no post-recovery object completes, if no full collection runs, or if any returned object is torn.
  • Full sharded units pass with the corrected witness.
11 days ago

Implemented and pushed to main as test(gc): make recovery pressure witness deterministic (#534). Evidence: pristine main reproduced the old focused failure; the corrected witness passed three consecutive focused runs (2.11 s, 3.16 s, 2.35 s). It now records the actual pressure OOM, requires a successfully validated post-recovery object, and proves a full collection ran. This is test-only and flips 0 test262 cases.

Sign in to comment on this issue.