ReviewOS

zig-utils/zig-js

Test: tolerate conservative ArrayBuffer recovery roots under TSan

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

Related: #50, #100

Failure

CI run https://github.com/zig-utils/zig-js/actions/runs/29449252934 failed only tsan-unit (shard 1/4) at enable_gc: heap_limit_bytes retries ArrayBuffer byte allocation after collection: after the successful retry, gc_array_buffer_bytes_live was 40 MiB instead of the test-exclusive 20 MiB. The same full TSan suite passed locally before publication.

Root cause

The allocation-failure path intentionally performs a conservative native-stack scan because arbitrary interpreter/Zig temporaries may hold managed values. A stale word in the newer CI Zig/TSan stack layout can conservatively retain the first unreachable ArrayBuffer wrapper for that one recovery collection. This is permitted collector behavior, not a leak: the second allocation still demonstrates that collection freed enough budget and the retry succeeded, while the subsequent quiescent precise collection must release every unreachable buffer exactly.

Scope / acceptance

  • Accept either one or two live 20 MiB buffers immediately after the successful recovery allocation; reject any other accounting value.
  • Keep the final post-drop quiescent collection assertion exact at the original baseline.
  • Preserve the initial below-allocation budget witness, successful retry, exact result, and separate exact ArrayBuffer-release test.
  • Pass the focused normal/TSan test and the next batched CI run.
11 days ago

Implemented and pushed as de0a781b (test(gc): allow conservative recovery roots (#121)). The intermediate assertion now accepts exactly one or two live 20 MiB buffers after the conservative recovery cycle; the post-drop quiescent collection still requires the exact original baseline. Focused gates are green: normal 2/2 and TSan 2/2, with 0 failures, leaks, or sanitizer reports. Keeping this open until the new full CI run completes.

11 days ago

Acceptance is complete. Focused normal/TSan coverage was green before publication, and combined main run 29462319298 completed every normal unit shard plus the exact tsan-unit shard 1 successfully at d35841a before a later Date-only follow-up superseded the run. The conservative recovery assertion remains bounded to exactly one or two live 20 MiB buffers, with the final quiescent baseline exact. Closing.

Sign in to comment on this issue.