Skip to content

Fix leaking orphan processes on macOS/Linux#62782

Open
zafnz wants to merge 1 commit intodart-lang:mainfrom
zafnz:fix-leaking-orphans
Open

Fix leaking orphan processes on macOS/Linux#62782
zafnz wants to merge 1 commit intodart-lang:mainfrom
zafnz:fix-leaking-orphans

Conversation

@zafnz
Copy link

@zafnz zafnz commented Feb 27, 2026

Process.start can leak orphaned child processes that sleep forever. When ProcessStarter::Start() encounters an error after fork() but before signalling the child to proceed, the cleanup path (CleanupAndReturnError) closes pipes but never kills the forked child. The child blocks forever in read(), waiting for a "go" signal that will never arrive.

This is exacerbated by a secondary issue: the child inherits the write end of its own signal pipe, so even when the parent closes its copy, the pipe doesn't break, the child's read() never returns EOF.

See #62781 for a full breakdown of everything.

Closes: #62781

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.

Process.start can leak orphaned child processes that sleep forever.
When ProcessStarter::Start() encounters an error **after** fork() but
**before** signaling the child to proceed, the cleanup path
(CleanupAndReturnError) closes pipes but never kills the forked child.
The child blocks forever in read(), waiting for a "go" signal that will
never arrive.

This is exacerbated by a secondary issue: the child inherits the write
end of its own signal pipe, so even when the parent closes its copy,
the pipe doesn't break, the child's read() never returns EOF.

Closes: dart-lang#62781 dart-lang#62781
@copybara-service
Copy link

Thank you for your contribution! This project uses Gerrit for code reviews. Your pull request has automatically been converted into a code review at:

https://dart-review.googlesource.com/c/sdk/+/484060

Please wait for a developer to review your code review at the above link; you can speed up the review if you sign into Gerrit and manually add a reviewer that has recently worked on the relevant code. See CONTRIBUTING.md to learn how to upload changes to Gerrit directly.

Additional commits pushed to this PR will update both the PR and the corresponding Gerrit CL. After the review is complete on the CL, your reviewer will merge the CL (automatically closing this PR).

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.

Process.start leaks orphaned child processes when parent fails after fork() on macOS+Linux

1 participant