Skip to content

fix(runner): prevent subprocess pipe deadlocks - #82

Open
March-77 wants to merge 1 commit into
bytedance:mainfrom
March-77:agent/drain-subprocess-pipes
Open

March-77 wants to merge 1 commit into
bytedance:mainfrom
March-77:agent/drain-subprocess-pipes

Conversation

@March-77

Copy link
Copy Markdown

Summary

  • drain stdout and stderr concurrently while commands run, while retaining at most 1 MiB per stream
  • run commands in isolated process groups and apply bounded cleanup on success, timeout, and caller cancellation
  • cover large exec/shell output, timeout output, stdin, cancellation, and descendant-process cleanup

Validation

  • targeted pytest on Windows compatibility harness: 9 passed, 3 POSIX-only tests skipped
  • pycln --check on both changed Python files
  • isort --check-only and yapf --diff on the new test module
  • python -m compileall on both changed Python files

The POSIX shell/process-group regressions are included for Linux CI; the local environment is Windows and had no usable Linux container runtime.

Fixes #53
Refs #62

@March-77
March-77 marked this pull request as ready for review July 23, 2026 03:36
@March-77

Copy link
Copy Markdown
Author

Revalidated on 2026-08-23 against main 469de08:

  • The PR remains clean and mergeable; no reviews or CI checks are currently present.
  • Main still waits for piped subprocesses before draining stdout and stderr, so the reported deadlock path remains unfixed there; the runner interface is unchanged.
  • All 12 targeted Python 3.11 subprocess tests passed, covering large stdout and stderr, bounded capture, timeout output, stdin, cancellation, and descendant cleanup.
  • PRs feat(pytest): support extra command-line arguments #81 and fix(runner): prevent subprocess pipe deadlocks #82 are independent: they share the same base and modify disjoint files.

No code-only refresh commit was added. Maintainer review would be appreciated.

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.

asyncio subprocess Process wait() deadlock

1 participant