fix: FreeBSD compile-program hang with large import closure (issue #78) #79
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-78-freebsd-compile-program-hang"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes #78 —
jerbuild buildhangs forever in[1/5] compile-programon FreeBSD amd64 (Chez 10.4.0 ta6fb).Root cause
Chez 10.4.0
compile-programwith a large import closure (194+ modules) enters an infinite loop on theta6fb(FreeBSD amd64 x86_64) machine-type. The same sources complete in ~2 minutes on macOStarm64osx.Symptoms: child process at 99% CPU, RSS oscillates 4.5–5.5 GB,
program.sostays 0 bytes. The freeze occurs incompile-program(andcompile-fileof the entry) regardless ofoptimize-level,cp0-effort-limit, or GC tuning. Individual library compilation (compile-fileper-module) works correctly.Diagnostic evidence:
sweep_generation/copy/S_find_segments(GC churn) with intermittent mutator frames inprocess-impspecsanddo-compile-filebiggus(FreeBSD 15.1 amd64, 133 GB RAM)compile-fileworks.sofiles into the library table beforecompile-programdoes not prevent the freezeoptimize-level 0,cp0-effort-limit 0,collect-trip-bytes (expt 2 31), and(compile-imported-libraries #f)all still freezeFix
Add
JERBOA_BINARY_FORCE_INPROCESS=1env var. When set, the binary build uses the in-process compilation path (same as non-multicall builds) instead of spawning a fresh subprocess. The in-process path runs inside the existing jerbuild image, which already has the bundle stdlib libraries loaded. This meanscompile-programonly processes the user library closure (smaller), bypassing the closure size threshold that triggers the FreeBSD Chez bug.Usage:
Verification
make binarybuilds and links successfully on macOS (arm64)Long-term
This is ultimately a Chez 10.4.0 ta6fb code-generation or import-resolution bug. A proper fix may require a Chez upgrade or a ta6fb-specific patch to the vendored Chez source. The env var workaround lets FreeBSD users build binaries today.
eb4b69770e6fabbceaf7