fix(pipeline): run compound command stages concurrently - #1242
Open
hartsock wants to merge 1 commit into
Open
Conversation
hartsock
marked this pull request as ready for review
July 20, 2026 14:48
Contributor
Author
This was referenced Jul 20, 2026
Performance Benchmark Report
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is Minimum allowed coverage is Test Summary: bash-completion test suite
|
hartsock
force-pushed
the
fix/compound-pipeline-stage-deadlock
branch
2 times, most recently
from
July 27, 2026 03:24
bd50bd8 to
0934b05
Compare
A compound command used as a non-final pipeline stage ran inline to completion instead of being spawned. Stages are set up in order, so the downstream stage did not exist yet and nothing drained the pipe; once the compound command wrote more than one pipe buffer (64 KiB on Linux and macOS) it blocked forever. Spawn the command onto a blocking task when it owns its shell, the same way builtins already run as owned-shell pipeline stages. The parent-shell case (single-command pipeline, or the last stage under lastpipe) still runs inline, preserving its side effects. Reproduced with `while ...; done | cat` emitting 32-byte lines: 2000 iterations (62 KiB) completed; 2100 (65 KiB) hung. Assisted-by: Claude Code:claude-opus-4-8
hartsock
force-pushed
the
fix/compound-pipeline-stage-deadlock
branch
from
July 31, 2026 03:24
0934b05 to
91cc76a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found during practical testing of compound commands.
A compound command used as a non-final pipeline stage runs inline to completion instead of being spawned, so the stage that would drain its output is never started. Once it writes more than one pipe buffer (64 KiB on Linux/macOS) it blocks forever.
bash completes both. The common shape is
... | while read x; do ...; done | sort | head.Spawn the command onto a blocking task when it owns its shell — the same shape
execute_via_builtin_in_owned_shellalready uses for builtin stages. The parent-shell case (single-command pipeline, or the last stage underlastpipe) still runs inline, preserving its side effects.The owned-shell path already executed against
Box::new(shell.clone()), so stage side effects were discarded before this change as well; only when the stage runs changes, not which shell it mutates.FunctionandExtendedTestshare the inline shape but write nothing to stdout, so they cannot fill a pipe — left unchanged.Adds one compat case (128 KiB through a
whilestage). Compat suite: 1773 passed / 0 failed, against 1772 / 0 onmain— exactly the added case, known-failures unchanged at 380.Tested in our downstream fork.