Skip to content

LinuxProcess: Start stdin relay after process start#478

Merged
dcantah merged 1 commit intoapple:mainfrom
dcantah:stdin-fix
Jan 16, 2026
Merged

LinuxProcess: Start stdin relay after process start#478
dcantah merged 1 commit intoapple:mainfrom
dcantah:stdin-fix

Conversation

@dcantah
Copy link
Member

@dcantah dcantah commented Jan 16, 2026

Fixes #477

Because we start piping stdin before process launch we can fill up the guest pipe buffer before the process even starts. We'd need some backpressure mechanism to handle this and slow consumers (register the other end with epoll and buffer some data etc.), but we should probably just start piping after the process is up and running. This change does exactly that, as well as stops holding the process mutex while draining stdin in the guest for CloseStdin().

This fixes issues where we try and write > pipe_buf bytes through stdin. Today this hangs.

Because we start piping stdin before process launch we can
fill up the guest pipe buffer before the process even starts.
We'd need some backpressure mechanism to handle this (register
the other end with epoll and buffer some data etc.), but we
should probably just start piping after the process is up and
running. This change does exactly that, as well as stops
holding the process mutex while draining stdin in the guest
for `CloseStdin()`.

This fixes issues where we try and write > pipe_buf bytes through
stdin. Today this hangs.
@dcantah dcantah merged commit 26f3dcc into apple:main Jan 16, 2026
2 checks passed
jglogan added a commit to apple/container that referenced this pull request Jan 20, 2026
saehejkang pushed a commit to saehejkang/container that referenced this pull request Jan 23, 2026
saehejkang pushed a commit to saehejkang/container that referenced this pull request Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Stdin pipe deadlocks when input exceeds 65536 bytes (OS Pipe Buffer Limit?)

2 participants

Comments