FreeBSD 15.1 amd64 ta6fb Chez 10.4.0 compile-program hangs with large import closure — full root-cause work plan #82
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Corrected investigation record
This issue tracks the unresolved Chez 10.4.0
ta6fbcompiler divergence observed on FreeBSD 15.1 amd64 (plaisio) while buildingober/jerboa-code.Live reproduction
On plaisio:
The build reaches
[1/5] Program compile. With the old shadowed Jerboa 0.12.6 binary, the freshjerboa runtime cross-wpo-compile.sschild stays at about 99% CPU, grows to roughly 4.6 GB RSS, and leavesprogram.soandprogram.wpoat zero bytes. Forcing the installed Jerboa 0.12.10 binary selects:but hangs identically: about 4.7 GB RSS, 99% CPU, and zero-byte output. Thus PR #79's in-process workaround is ineffective for this real jcode closure and was not validated on FreeBSD before merge.
An lldb attach during the spin showed
sweep_generation -> S_gc_ocd_entry -> S_do_gc. Raisingcollect-trip-bytesas high as2^35let RSS exceed 38 GB without output;optimize-level 0still hangs; preloading all 197 compiled library.sofiles still hangs. These controls do not establish a simple GC-threshold fix.Reduction achieved
The temporary source-bisection harness reduced the failure as follows:
The relevant real shape is:
The same source closure compiles on macOS arm64 in about two minutes. This currently points to a ta6fb/x86-64 Chez compiler-path defect, not a proven application runtime hang.
Eval hypothesis was tested and rejected as a sufficient fix
The jcode function:
was transformed in the generated source to a guard around
(void). The full exportedtui-maincompile still hung because the real event-loop remained reachable. Isolated syntheticeval,interaction-environment, andguardforms compiled quickly. Do not claim that removing this eval fixes the compiler hang without a fresh, source-faithful proof; the current evidence says the event-loop compiler path is the stronger trigger.Ready toolchain and next investigation
A native ta6fb toolchain was built successfully on plaisio:
Checkout HEAD used for the build was
51512333;gmake buildcompleted with 22 compiled and 0 skipped.Next steps:
s/compile.ssaround thecfh0read/expand loop (compile.ss:646-702),compile-file-help1/2, and theexpandcall. Add flushed low-allocation phase/form counters.s/syntax.sschi-bodyand library-body-to-IR paths, thens/cpnanopass.ssaround lambda/letrec/guard/continuation lowering. Instruments/x86_64.ssonly after proving earlier passes complete.gmake binaryCI job; current FreeBSD CI runsgmake buildbut does not exercise this binary path.No repository source was changed during this investigation. The durable handoff is
~/fix-jerboa-fbsd-trace-hangs-eval.md.Fixed by PR #89: #89 (merged as
1cda118d, VERSION 0.12.18).Root cause: both match compilers (src/jerboa/core.ss and lib/std/match2.ss, the prelude match) embedded the compiled rest-of-clauses chain as code at every pattern failure point (2+ per clause), doubling expansion per clause — compile time and .so size grew exponentially with clause count (tui.so hit 13.5MB; the jerboa-code build froze).
Fix: compile the rest chain once per clause position behind a letrec-bound fail thunk; failure points emit calls. Regression-gated by tests/test-issue82-regression.ss in FreeBSD CI.
Post-fix: mr82-c13 18.8s -> 0.10s, c16/c20 ~0.1s; full toolchain test suite green; real consumer ober/jerboa-code builds (tui.so 377KB) with test/run.ss 1623/1623 passing.