Skip to content

fix(tsrs_execute): poll and retry stdout writes on EAGAIN - #1017

Open
oxc-captain[bot] wants to merge 1 commit into
mainfrom
triagebot/fix-1015
Open

oxc-captain[bot] wants to merge 1 commit into
mainfrom
triagebot/fix-1015

Conversation

@oxc-captain

@oxc-captain oxc-captain Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

What and why

When tsrs inherited a stdout pipe in O_NONBLOCK mode, writes that filled the pipe buffer returned EAGAIN (std::io::ErrorKind::WouldBlock) and were silently discarded. This made --listFilesOnly stop at the pipe-buffer size and exit 0, and large diagnostic listings stop partway through, while the pinned TypeScript Go compiler (tsc-go) printed everything.

Go's cmd/tsc/sys.go uses os.Stdout directly; the Go runtime parks the goroutine and polls the descriptor on EAGAIN, so writes appear to block until the reader drains the pipe. tsrs now matches that behavior: a StdoutWriter wraps std::io::Stdout, polls for POLLOUT on WouldBlock/Interrupted, and retries.

The existing broken_pipe integration test still covers the case where the reader closes; this change only affects the live-but-full pipe case.

Evidence

  • Reproduced against the pinned TypeScript Go compiler (microsoft/TypeScript@v7.1-beta, 3e9236361fa97a9e6c685f4833ac457ae2d8c50a):
    • Before the fix, non-blocking output stopped at 65,536 bytes for --listFilesOnly and at a partial diagnostic count for error listings.
    • After the fix, tsrs prints identical output in blocking and non-blocking modes, matching tsc-go.
  • Added crates/tsrs_cli/tests/integration/nonblocking_stdout.rs with two regression tests; list_files_only_is_complete_on_a_non_blocking_stdout fails before the fix and passes after it.
  • cargo test --profile dev --locked -p tsrs_cli --test integration -- broken_pipe nonblocking_stdout --test-threads=1: ok. 3 passed; 0 failed.
  • tools/regressions.sh target/debug/tsrs: all 54 regression cases pass.
  • cargo clippy --all-targets --locked --config 'build.warnings="deny"' -p tsrs_cli -p tsrs_execute: passes.
  • node tools/lint/source.mjs: passes.

Closes #1015.

Automated triagebot fix.

@oxc-captain oxc-captain Bot added the fix verified Pull request created from a verified automated fix label Nov 17, 2026
@codspeed

codspeed Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

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 triagebot/fix-1015 (d33a95b) with main (7eb504d)

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. ↩

@github-actions

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run · main 7eb504db5ce5 → PR merge 509e23d484fe (head d33a95b12a2b)

Clef gate: Clef estimated 37.3% default and single-threaded wall time, 30.3% peak RSS, 36.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 +1.0% 0.000% -5.2% +0.2%
vscode incremental -1.1% +0.001% -3.6% +0.1%
xstate-main check -1.0% 0.000% -2.8% -0.1%
xstate-main incremental -4.2% -0.001% -5.6% +0.1%
webpack check -2.2% +0.002% +4.0% -0.3%
webpack incremental -0.3% +0.002% +2.3% 0.0%
mui-docs check +1.1% -0.002% +2.4% +0.2%
mui-docs incremental +0.5% +0.005% +6.4% -0.3%
Compiler check +2.7% 0.000% +0.1% +1.3%
Compiler incremental -4.9% 0.000% +2.6% +0.1%
Compiler-Unions check -0.6% 0.000% -0.2% +0.1%
Compiler-Unions incremental -0.6% +0.001% +0.3% -0.6%
cal-diy check +1.4% +0.002% +6.1% 0.0%
cal-diy incremental 0.0% +0.006% +2.8% +0.1%
formbricks-web check -0.1% +0.001% -1.4% -0.1%
formbricks-web incremental +1.2% -0.002% +0.4% +0.1%
supabase-studio check -1.3% -0.006% +4.2% +0.3%
supabase-studio incremental -2.0% +0.001% +0.4% 0.0%
t3code-server check +1.5% +0.002% -0.3% +0.5%
t3code-server incremental -2.6% +0.002% -2.4% -0.2%
mikro-orm check -0.2% 0.000% +1.0% +0.3%
mikro-orm incremental +0.1% 0.000% +0.4% -0.1%
next-packages-next check -0.6% +0.003% +0.8% -0.1%
next-packages-next incremental +1.0% -0.002% -4.0% +0.1%
next-root check -5.9% +0.002% -0.7% +0.4%
next-root incremental +2.2% 0.000% -3.0% +0.2%
storybook check +8.0% -0.001% -4.8% +0.3%
storybook incremental +6.3% +0.002% -5.7% -0.1%
nuxt check +1.9% -0.003% +1.0% +0.4%
nuxt incremental +1.4% -0.007% -0.1% -0.2%
playwright check 0.0% -0.001% +0.8% +1.9%
playwright incremental +4.2% -0.003% +0.6% +0.2%
drizzle-orm check +7.5% +0.003% +1.6% +1.2%
drizzle-orm incremental +5.6% +0.004% +6.6% 0.0%
typeorm check -2.8% -0.002% +4.4% -0.1%
typeorm incremental +0.8% -0.002% -5.8% 0.0%
date-fns check -2.0% +0.006% -1.8% +0.9%
date-fns incremental +0.5% -0.002% -0.2% +1.3%

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 15.297 → 15.023 82,245,903,750 → 82,245,748,759 2.406 → 2.299 1837.7 → 1840.7
vscode incremental 12.983 → 12.832 84,659,905,941.5 → 84,660,115,754 2.444 → 2.327 2160.7 → 2163.5
xstate-main check 0.765 → 0.738 5,562,495,692 → 5,562,488,918 0.209 → 0.202 241.6 → 241.2
xstate-main incremental 1.071 → 0.997 5,724,994,972 → 5,724,981,065.5 0.387 → 0.367 243.8 → 244.1
webpack check 2.016 → 1.904 10,881,492,790.5 → 10,881,778,095.5 0.425 → 0.427 405.0 → 403.6
webpack incremental 1.309 → 1.322 11,105,316,685.5 → 11,105,312,634.5 0.295 → 0.307 403.2 → 403.2
mui-docs check 2.963 → 3.008 33,086,225,639 → 33,085,858,385 1.037 → 1.053 1222.2 → 1224.7
mui-docs incremental 4.324 → 4.389 34,427,322,263.5 → 34,426,278,143 2.067 → 2.360 1162.3 → 1158.4
Compiler check 0.257 → 0.266 1,775,698,941 → 1,775,698,008.5 0.122 → 0.119 77.2 → 78.2
Compiler incremental 0.347 → 0.324 1,788,508,649.5 → 1,788,508,612 0.150 → 0.156 79.6 → 79.7
Compiler-Unions check 0.270 → 0.270 3,053,509,398 → 3,053,494,533 0.100 → 0.104 81.4 → 81.5
Compiler-Unions incremental 0.225 → 0.226 3,065,338,858.5 → 3,065,346,324 0.103 → 0.102 85.4 → 84.9
cal-diy check 4.195 → 4.209 28,940,235,828.5 → 28,940,984,788 1.108 → 1.182 1356.0 → 1355.9
cal-diy incremental 5.135 → 5.157 30,559,518,083.5 → 30,561,104,645.5 2.258 → 2.336 1265.0 → 1266.6
formbricks-web check 3.712 → 3.684 37,059,512,888 → 37,059,087,387.5 0.873 → 0.855 1583.3 → 1581.2
formbricks-web incremental 4.986 → 5.018 39,659,395,090 → 39,659,871,108.5 1.426 → 1.467 1622.5 → 1624.6
supabase-studio check 9.676 → 9.435 40,789,296,400.5 → 40,787,588,792.5 1.989 → 2.084 1307.0 → 1310.7
supabase-studio incremental 5.027 → 5.027 43,737,501,341.5 → 43,737,065,043.5 1.305 → 1.302 1364.5 → 1363.9
t3code-server check 5.975 → 6.133 41,048,737,371 → 41,049,717,333 2.306 → 2.321 1443.0 → 1450.3
t3code-server incremental 5.342 → 5.270 41,572,153,848 → 41,573,442,482.5 1.905 → 1.910 1306.9 → 1303.8
mikro-orm check 5.768 → 5.707 44,512,466,949 → 44,513,084,555 1.339 → 1.336 1282.6 → 1285.9
mikro-orm incremental 6.334 → 5.938 44,824,214,551.5 → 44,824,307,876 1.475 → 1.532 1258.7 → 1257.7
next-packages-next check 3.907 → 3.863 17,394,449,914 → 17,394,862,947 1.074 → 1.057 559.8 → 559.3
next-packages-next incremental 2.038 → 2.155 17,720,264,818 → 17,720,211,755.5 0.752 → 0.733 563.9 → 564.2
next-root check 1.624 → 1.548 13,951,502,699.5 → 13,951,902,081.5 0.301 → 0.306 430.4 → 432.4
next-root incremental 1.629 → 1.687 14,413,368,742.5 → 14,413,351,537 0.362 → 0.351 472.4 → 473.3
storybook check 1.726 → 1.707 8,859,803,748 → 8,859,723,737.5 0.379 → 0.351 396.6 → 397.6
storybook incremental 1.381 → 1.416 9,184,441,627.5 → 9,184,369,745.5 0.557 → 0.505 374.5 → 374.2
nuxt check 1.014 → 1.031 8,491,545,453 → 8,491,221,837.5 0.262 → 0.264 389.6 → 391.1
nuxt incremental 1.168 → 1.163 8,893,414,186 → 8,892,976,332 0.307 → 0.313 392.7 → 392.0
playwright check 0.874 → 0.858 7,399,713,760.5 → 7,399,643,500.5 0.241 → 0.239 357.9 → 364.5
playwright incremental 0.948 → 0.902 7,573,085,341.5 → 7,572,841,590.5 0.219 → 0.215 340.3 → 341.1
drizzle-orm check 1.281 → 1.343 5,944,884,317 → 5,944,925,537 0.390 → 0.435 375.7 → 380.4
drizzle-orm incremental 0.900 → 1.038 6,116,038,500.5 → 6,116,302,886.5 0.272 → 0.287 344.9 → 344.9
typeorm check 1.157 → 1.294 6,385,780,670 → 6,385,740,691 0.264 → 0.266 226.8 → 226.6
typeorm incremental 1.317 → 1.358 6,762,801,208 → 6,762,631,788 0.345 → 0.333 233.3 → 233.3
date-fns check 0.426 → 0.423 3,344,938,114.5 → 3,344,914,555.5 0.135 → 0.134 151.9 → 153.2
date-fns incremental 0.384 → 0.389 3,581,290,330.5 → 3,581,270,897 0.180 → 0.176 162.6 → 164.7

tsrs-lint

The main and PR tsrs-lint binaries are byte-for-byte identical. No lint performance difference to measure.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix verified Pull request created from a verified automated fix

Development

Successfully merging this pull request may close these issues.

Native binary drops stdout on a full non-blocking pipe and still exits normally

0 participants