Skip to content

fix(process): drain pipes in poll-based graceful-timeout to prevent deadlock#220

Merged
azchin merged 2 commits into
mainfrom
fix/pipe-poll-deadlock-valkey-worker
May 28, 2026
Merged

fix(process): drain pipes in poll-based graceful-timeout to prevent deadlock#220
azchin merged 2 commits into
mainfrom
fix/pipe-poll-deadlock-valkey-worker

Conversation

@azchin

@azchin azchin commented May 28, 2026

Copy link
Copy Markdown
Contributor

The poll-based branch of run_with_graceful_timeout (taken when stop_event is non-None) never read from stdout/stderr pipes between polls. When oss-crs runs headless it prints all docker buildx bake output line-by-line; the runner-image build produces >1 MB of --progress rawjson, filling the OS pipe buffer (1 MB on Linux). The subprocess then blocks on pipe_write while the poll loop sleeps, and the run container never starts.

Fix: start background reader threads that drain stdout/stderr throughout the poll loop. On timeout or early-stop, send SIGTERM/SIGKILL via _signal_and_wait (which uses process.wait, not process.communicate) so there is no race with the background threads on the pipe FDs.

@azchin azchin merged commit cb4a4c3 into main May 28, 2026
5 checks passed
@azchin azchin deleted the fix/pipe-poll-deadlock-valkey-worker branch May 28, 2026 17:47
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.

1 participant