Skip to content

fix(build): TSRS_MEM_SPLIT=1 no longer crashes tsrs -b with more than one builder - #1087

Merged
maschwenk merged 1 commit into
mainfrom
max/memsplit-concurrent-builders
Nov 25, 2026
Merged

maschwenk merged 1 commit into
mainfrom
max/memsplit-concurrent-builders

Conversation

@maschwenk

Copy link
Copy Markdown
Collaborator

TSRS_MEM_SPLIT=1 tsrs -b segfaulted or hung once more than one builder ran and the workspace had more than a few projects (#1085). a program's parse end and check end reports 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 theirs

the 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, -p and the language server report as before. the new build_mem_split test builds 24 projects with -b --builders 4 under TSRS_MEM_SPLIT=1

on 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, 4 and 16 over 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 without TSRS_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

…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
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run Β· main 96fbb8d499d2 β†’ PR merge dfb978b50d48 (head da78885400bd)

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.
Incremental runs start with fresh build info before every invocation; check runs disable incremental compilation.

Project Mode Single-thread wall time Ξ” Single-thread instructions Ξ” Default wall time Ξ” Default peak RSS Ξ”
vscode check +0.1% -0.001% 0.0% -0.1%
vscode incremental 0.0% +0.001% -0.7% -0.1%
xstate-main check 0.0% +0.001% -0.5% +0.1%
xstate-main incremental -0.8% +0.001% -1.1% -0.1%
webpack check -0.1% +0.002% +2.1% 0.0%
webpack incremental +0.1% -0.001% -2.9% 0.0%
mui-docs check +0.1% -0.001% +0.5% +1.0%
mui-docs incremental +0.2% +0.006% -0.2% 0.0%
Compiler check 0.0% 0.000% +0.1% +2.7%
Compiler incremental +0.7% 0.000% +0.7% -0.3%
Compiler-Unions check -0.5% 0.000% -0.1% +0.2%
Compiler-Unions incremental -1.0% 0.000% -0.8% +0.6%
cal-diy check -0.4% -0.004% -0.2% +0.3%
cal-diy incremental -0.1% -0.002% -0.6% 0.0%
formbricks-web check -0.2% -0.001% -0.5% 0.0%
formbricks-web incremental 0.0% +0.001% +0.5% -0.2%
supabase-studio check +3.3% -0.001% -0.5% +0.1%
supabase-studio incremental -0.3% +0.001% -0.5% -0.1%
t3code-server check +0.2% -0.001% -0.5% +0.6%
t3code-server incremental -0.4% -0.005% -0.5% -0.2%
mikro-orm check -0.4% +0.003% +1.3% -0.2%
mikro-orm incremental +0.1% -0.001% +0.9% -0.1%
next-packages-next check -0.1% +0.001% +0.2% +0.5%
next-packages-next incremental -0.3% -0.002% +0.1% -0.2%
next-root check +0.5% +0.001% +1.1% -0.2%
next-root incremental -0.2% 0.000% -1.3% +0.3%
storybook check +0.1% 0.000% +0.9% -0.3%
storybook incremental -0.2% +0.005% -1.0% -0.3%
nuxt check -0.3% 0.000% -1.1% -0.1%
nuxt incremental -0.4% -0.003% -4.3% +0.1%
playwright check -0.9% 0.000% 0.0% -0.5%
playwright incremental -0.2% +0.003% +0.2% 0.0%
drizzle-orm check +0.9% +0.001% +5.0% +2.9%
drizzle-orm incremental -1.4% +0.002% -2.3% +0.2%
typeorm check -0.5% 0.000% -2.3% +0.1%
typeorm incremental +0.5% 0.000% -5.4% -0.1%
date-fns check -1.1% +0.001% +1.0% -0.2%
date-fns incremental -0.9% -0.004% -0.4% -1.1%

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)
Project Mode Single-thread wall time (s) Single-thread instructions Default wall time (s) Default peak RSS (MiB)
vscode check 8.467 β†’ 8.484 82,266,587,705.5 β†’ 82,266,026,333 1.467 β†’ 1.467 1839.4 β†’ 1838.4
vscode incremental 8.511 β†’ 8.517 84,683,243,348.5 β†’ 84,684,069,856 1.671 β†’ 1.654 2164.1 β†’ 2162.3
xstate-main check 0.516 β†’ 0.516 5,566,822,667 β†’ 5,566,891,348.5 0.129 β†’ 0.126 241.8 β†’ 242.0
xstate-main incremental 0.530 β†’ 0.525 5,728,448,653.5 β†’ 5,728,558,768.5 0.157 β†’ 0.157 244.5 β†’ 244.2
webpack check 0.919 β†’ 0.919 10,885,419,394 β†’ 10,885,530,830 0.194 β†’ 0.197 405.1 β†’ 405.0
webpack incremental 0.953 β†’ 0.961 11,109,404,642 β†’ 11,109,086,331.5 0.248 β†’ 0.241 403.2 β†’ 403.3
mui-docs check 2.366 β†’ 2.370 33,107,955,637 β†’ 33,109,655,542 0.947 β†’ 0.954 1216.2 β†’ 1228.9
mui-docs incremental 2.514 β†’ 2.513 34,461,077,173 β†’ 34,464,180,357 1.113 β†’ 1.108 1160.6 β†’ 1161.0
Compiler check 0.140 β†’ 0.145 1,775,532,151 β†’ 1,775,535,241.5 0.065 β†’ 0.064 75.9 β†’ 77.9
Compiler incremental 0.138 β†’ 0.140 1,789,927,923 β†’ 1,789,928,662.5 0.064 β†’ 0.065 79.8 β†’ 79.6
Compiler-Unions check 0.195 β†’ 0.194 3,053,221,769.5 β†’ 3,053,238,406 0.091 β†’ 0.090 81.5 β†’ 81.7
Compiler-Unions incremental 0.201 β†’ 0.196 3,064,795,263 β†’ 3,064,777,961 0.094 β†’ 0.094 84.7 β†’ 85.3
cal-diy check 2.566 β†’ 2.557 28,975,323,286.5 β†’ 28,974,348,503.5 0.815 β†’ 0.816 1354.2 β†’ 1358.3
cal-diy incremental 2.678 β†’ 2.673 30,594,269,577 β†’ 30,595,084,745.5 1.017 β†’ 1.010 1266.5 β†’ 1266.8
formbricks-web check 3.337 β†’ 3.323 37,089,685,773 β†’ 37,088,791,857 0.869 β†’ 0.866 1578.5 β†’ 1577.8
formbricks-web incremental 3.566 β†’ 3.574 39,693,960,959 β†’ 39,693,809,375 1.067 β†’ 1.077 1626.9 β†’ 1623.7
supabase-studio check 4.047 β†’ 4.130 40,826,028,339 β†’ 40,825,640,163.5 0.918 β†’ 0.902 1307.1 β†’ 1308.6
supabase-studio incremental 4.124 β†’ 4.115 43,772,202,039.5 β†’ 43,772,637,097.5 1.134 β†’ 1.129 1366.1 β†’ 1364.9
t3code-server check 3.527 β†’ 3.533 41,057,816,430.5 β†’ 41,057,919,744.5 1.573 β†’ 1.576 1443.1 β†’ 1451.6
t3code-server incremental 3.599 β†’ 3.583 41,584,353,489 β†’ 41,582,559,076.5 1.406 β†’ 1.409 1306.6 β†’ 1304.2
mikro-orm check 4.151 β†’ 4.116 44,485,658,485.5 β†’ 44,487,376,451.5 0.866 β†’ 0.875 1277.6 β†’ 1275.4
mikro-orm incremental 4.032 β†’ 4.040 44,796,212,600.5 β†’ 44,795,374,905 1.077 β†’ 1.089 1259.6 β†’ 1258.1
next-packages-next check 1.444 β†’ 1.441 17,406,070,411 β†’ 17,406,185,016 0.363 β†’ 0.363 558.3 β†’ 560.9
next-packages-next incremental 1.493 β†’ 1.490 17,733,033,854 β†’ 17,732,780,595.5 0.440 β†’ 0.440 564.9 β†’ 563.6
next-root check 1.171 β†’ 1.176 13,996,258,590 β†’ 13,996,333,051.5 0.255 β†’ 0.259 433.1 β†’ 432.1
next-root incremental 1.220 β†’ 1.216 14,458,904,025 β†’ 14,459,141,983.5 0.317 β†’ 0.315 472.6 β†’ 473.8
storybook check 0.767 β†’ 0.768 8,867,517,066.5 β†’ 8,867,519,711 0.202 β†’ 0.201 398.6 β†’ 397.4
storybook incremental 0.794 β†’ 0.794 9,192,627,058.5 β†’ 9,193,061,510 0.239 β†’ 0.238 375.8 β†’ 374.8
nuxt check 0.814 β†’ 0.807 8,502,120,738.5 β†’ 8,502,183,771 0.212 β†’ 0.207 391.0 β†’ 390.8
nuxt incremental 0.886 β†’ 0.887 8,905,019,766.5 β†’ 8,904,728,749.5 0.244 β†’ 0.231 392.2 β†’ 392.6
playwright check 0.667 β†’ 0.664 7,403,423,505 β†’ 7,403,279,594 0.178 β†’ 0.178 362.3 β†’ 360.4
playwright incremental 0.690 β†’ 0.688 7,576,758,664.5 β†’ 7,576,781,446 0.193 β†’ 0.196 339.4 β†’ 339.3
drizzle-orm check 0.521 β†’ 0.522 5,948,915,253.5 β†’ 5,948,685,950.5 0.171 β†’ 0.182 377.9 β†’ 389.0
drizzle-orm incremental 0.537 β†’ 0.533 6,120,413,550 β†’ 6,120,501,351.5 0.183 β†’ 0.175 344.0 β†’ 344.7
typeorm check 0.591 β†’ 0.587 6,398,335,908.5 β†’ 6,398,358,290.5 0.135 β†’ 0.131 226.4 β†’ 226.6
typeorm incremental 0.652 β†’ 0.653 6,776,162,167.5 β†’ 6,775,995,891 0.181 β†’ 0.175 233.8 β†’ 233.5
date-fns check 0.296 β†’ 0.296 3,351,846,611.5 β†’ 3,352,090,154 0.102 β†’ 0.102 152.7 β†’ 152.4
date-fns incremental 0.306 β†’ 0.305 3,590,188,953.5 β†’ 3,589,729,035.5 0.147 β†’ 0.147 165.0 β†’ 163.2

tsrs-lint

Release tsrs-lint linting each project's source files with all 61 rules. After a warmup run of each binary, alternating main/PR pairs (10 per mode) measure wall time, CPU time and peak RSS with TSRS_FAST unset and with TSRS_FAST=1.

Project Mode Wall time Ξ” CPU time Ξ” Peak RSS Ξ” Diagnostics (main β†’ PR)
webpack default +1.9% +1.6% +0.2% 35405, identical
webpack TSRS_FAST=1 -0.1% +0.7% -0.2% 35405, identical
drizzle-orm default +0.9% -0.7% +0.1% 7057, identical
drizzle-orm TSRS_FAST=1 -0.9% -0.8% -0.4% 7057, identical
xstate-main default +0.3% +0.2% +1.2% 6489, identical
xstate-main TSRS_FAST=1 -2.2% -1.3% -0.3% 6489, identical

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)
Project Mode Wall time (s) CPU time (s) Peak RSS (MiB)
webpack default 0.356 β†’ 0.362 1.830 β†’ 1.853 464.2 β†’ 464.9
webpack TSRS_FAST=1 0.358 β†’ 0.357 1.837 β†’ 1.850 464.7 β†’ 464.0
drizzle-orm default 0.215 β†’ 0.217 1.161 β†’ 1.160 403.4 β†’ 403.8
drizzle-orm TSRS_FAST=1 0.216 β†’ 0.216 1.157 β†’ 1.155 404.2 β†’ 402.7
xstate-main default 0.314 β†’ 0.315 1.373 β†’ 1.380 339.3 β†’ 343.5
xstate-main TSRS_FAST=1 0.317 β†’ 0.312 1.389 β†’ 1.374 342.8 β†’ 341.9

@maschwenk
maschwenk marked this pull request as ready for review November 25, 2026 05:14
@maschwenk
maschwenk added this pull request to the merge queue Nov 25, 2026
@codspeed

codspeed Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

Warning

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

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

βœ… 8 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing max/memsplit-concurrent-builders (da78885) with main (4ffdb88)2

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (96fbb8d) during the generation of this report, so 4ffdb88 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Merged via the queue into main with commit 4ffdb88 Nov 25, 2026
73 checks passed
@maschwenk
maschwenk deleted the max/memsplit-concurrent-builders branch November 25, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

TSRS_MEM_SPLIT=1 segfaults under tsc -b with more than one builder

2 participants