Repository navigation
fix(build): TSRS_MEM_SPLIT=1 no longer crashes tsrs -b with more than one builder - #1087
Conversation
β¦lders TSRS_MEM_SPLIT=1 crashed or hung under -b with more than one builder. A program's reports at parse end and check end read every thread's arena and walk mimalloc's pages, and the walk collects frees on pages that other threads own. That is only safe while the threads that allocate are parked: true for one program, not while other builders build theirs, nor at exit while their checker threads still run. With more than one builder, only the report at exit runs now, without the allocator walk. A single builder, -p and the language server report as before. Fixes #1085
Performance change vs mainWorkflow run Β· main Clef gate: Clef estimated 25.8% default and single-threaded wall time, 32.7% peak RSS, 32.4% single-threaded instruction count impact probability. Release builds in fast mode (TSRS_FAST=1) with Hyperfine 2 hardware counters. After warming each binary, alternating main/PR pairs measure wall time at both the fast preset's default checker count and with --singleThreaded, with ten pairs per configuration by default. Instructions come from the single-threaded runs; peak RSS comes from the default-count runs.
Negative means the PR used less; positive means it used more. Deltas are medians of paired PR/main ratios for wall time and instructions. Single-threaded runs reduce scheduling noise; shared CI machines can still add noise to wall time. Measured medians (main β PR)
tsrs-lintRelease
Negative means the PR used less. Wall and CPU time deltas are medians of paired PR/main ratios; peak RSS compares medians. Measured lint medians (main β PR)
|
Merging this PR will not alter performanceWarning oxc-project has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed. 1 warning
Comparing Footnotes
|
TSRS_MEM_SPLIT=1 tsrs -bsegfaulted or hung once more than one builder ran and the workspace had more than a few projects (#1085). a program'sparse endandcheck endreports read every thread's arena and walk mimalloc's pages (mimalloc_heap_stats), and the walk collects frees on pages other threads own. that's only safe while those threads are parked, which holds for one program but not while other builders build theirsthe fix is Christian Vuerings's, from christianvuerings#14. with more than one builder, only the exit report runs, and it skips the allocator walk and says so.
--builders 1,-pand the language server report as before. the newbuild_mem_splittest builds 24 projects with-b --builders 4underTSRS_MEM_SPLIT=1on a 16-vCPU Graviton box (release builds, workspaces from the #1075 generator), main crashed in every multi-builder run: 66 of 66 at
--builders 2,4and16over 20 to 2,000 projects, 65 segfaults and one abort. this branch passed every one of the same runs, with emitted files and stdout byte-identical to a run withoutTSRS_MEM_SPLIT. the new test fails 3 of 3 on main (abort) and passes 3 of 3 here#821 has its own take on the same race beside its arena change
Fixes #1085
Co-authored-by: Christian Vuerings 127199+christianvuerings@users.noreply.github.com