ReviewOS

zig-utils/zig-js

ABI fixture: make shared-memfd test reliable under parallel build load

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

Parent: #163 Related: #376 Roadmap: #134

A combined Home/Bun build linked every focused private-ABI fixture against the single library selected by -Dprivate-abi-consumer. With bun selected, the Home fixture passed Home's pinned ArrayBuffer and Uint8Array tags (48 and 50) to a Bun-tagged library. ArrayBuffer__fromSharedMemfd correctly rejected that profile mismatch as an empty value, which the fixture only reported later as shared memfd ArrayBuffer pointer lookup failed.

The installed/importable zig-js library still follows the requested consumer profile. Focused Home and Bun fixtures now link profile-specific libraries, so mixed invocations are hermetic in either direction. The dedicated gate runs two Home value fixtures and two Bun FetchHeaders fixtures concurrently.

Reproduction covered:

zig build test-private-abi-mixed-profiles -Dprivate-abi-consumer=bun
zig build test-private-abi-mixed-profiles -Dprivate-abi-consumer=bun -Doptimize=ReleaseSafe
zig build test-private-abi-mixed-profiles -Dprivate-abi-consumer=home

Acceptance:

  • Identify whether descriptor sizing, mmap, allocation pressure, or build-run concurrency makes ArrayBuffer__fromSharedMemfd return an empty value. It was none of these: the library used the wrong private JSType profile.
  • Make the fixture report the failing native stage/error instead of collapsing it into a later pointer lookup failure.
  • Keep exact private writable mapping, byte-slice, and descriptor non-consumption assertions.
  • Add a deterministic parallel-load/repetition gate that passes in Debug and ReleaseSafe.
  • Do not serialize unrelated ABI fixtures unless the underlying API is intentionally process-global.

Implemented by 8270d17.

9 days ago

Fixed and pushed to main in 8270d17. The mixed-profile gate passed with two concurrent Home 388/388 runs and two concurrent Bun FetchHeaders 25/25 runs in Bun-selected Debug, Bun-selected ReleaseSafe, and inverse Home-selected Debug configurations. The underlying memfd mapping assertions remain intact; the build now prevents the Home fixture from linking a Bun-tagged private ABI library (and vice versa).

Sign in to comment on this issue.