You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
yes | head -100000 | while read never terminates; rubash.exe RSS grows past 8 GB #206
Found during rubash#186 perf work (worktree wt/o4-perf, baseline c9bd0af, release build).
Reproducer (script file, Windows side):
yes | head -100000 |whileread -r l;do:;done
Expected (GNU Bash 5.3.0, WSL): finishes in well under a second, exits 0.
Actual (rubash.exe release, c9bd0af + wt/o4-perf ast_exec preamble fixes):
The run never terminates (>5 minutes, killed).
One rubash.exe process grows monotonically past 8.4 GB RSS (PID observed at 8,394,964 K in tasklist before taskkill).
The simpler yes | head -100000 > /dev/null form is fine (~150 ms), so the leak sits on the while read consumer side of a builtin pipeline with an external producer, not in the external pipe itself.
Suspects (not yet root-caused): builtin-pipeline staging in src/executor/pipeline_exec.rs (each staged line retained in a per-stage buffer?), or the read builtin's leftover-buffer handling re-appending to an unbounded capture buffer (src/executor/read_builtin.rs).
Artifacts: bench scripts under D:/repo/rubash-wt-o4-perf/target-perf/ (b_pipe3.sh).
Activity
pipeline/read: run external prefixes on real pipes; heredoc fatal-err…
caomengxuan666 commentedon Sep 27, 2026
已修复并合入 master(commit a39d4f0c,lane wt/read)。根因(实证):全外部成员的管道走并发 OS 管道路径,但带 shell 侧尾段(while read)的管道退回顺序逐段路径——该路径在前一段完成前把每段输出全量物化,于是 stage-0 的 yes 被完整 slurp 进单个 Vec,head 根本没被拉起。修复:新增 execute_external_prefix_concurrently——前导 ≥2 个外部成员在真实 OS 管道上并发执行(GNU execute_cmd.c:2620 execute_pipeline 语义),只捕获最后一个外部成员的有界输出喂给顺序尾段;并移除 read 的每记录全缓冲克隆(read.def:731 zread O(record))。实测:N=10000 从不终止(RSS 4.1GB 攀升被杀)→ rc=0 峰值 5MB <1s;N=100000 约 7s 完成。已知出范围:被杀生产者的 PIPESTATUS 3328 vs GNU 141(无 SIGPIPE,Windows 并发路径既有行为)。Unix 侧暂以 stub 保持顺序行为(后续跟进)。合并说明:与 #205/#192 的同文件修复做了三方融合(spec 函数化 + expand_stage argv 机器 + VAR= 准入),三者矩阵均已复验。感谢报告!
perf-suite: dedicated benchmark harness + first baseline (24 probes, …
fix(pipeline): Windows broken-pipe kill window arms only after the do…