fix: add exit event fallback for child process close hang on Windows#26147
fix: add exit event fallback for child process close hang on Windows#26147bingkxu wants to merge 1 commit into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Related PRs Found
PR #25672 - #25672 (fix: prevent pkill hang when close event never fires)
|
On Windows, when a child process spawns grandchild processes (e.g., build tools like hvigor/Gradle daemons), the grandchild may inherit the stdout/stderr pipe handles. Even after the direct child exits, these inherited handles keep the pipe open, preventing Node.js 'close' event from firing. Since exitCode was resolved only on 'close', this caused bash tool to hang indefinitely in Effect.raceAll waiting for handle.exitCode. Fix: resolve exitCode on 'exit' event with a 2-second fallback. If 'close' fires within 2 seconds (normal case), behavior is unchanged. If 'close' does not fire (daemon holds pipe handle), fallback resolves after 2 seconds. Closes anomalyco#24784
0f1e6c6 to
a3c16fd
Compare
|
3 weeks ago, and still not even reviewed? |
|
Thanks for your patience. This PR is awaiting maintainer review — I've bumped it for attention. The fix addresses a Windows-specific child process hang issue that impacts reliability. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
|
Could this be re-opened? According to this comment, this PR is the preferred solution. |
|
It's messed up that this issue, which still hasn’t been fixed, made me switch from OpenCode, and it’s funny how no one seems to care enough to even look at it. |
Issue for this PR
Closes #24784
Replaces #24783 (stale - branch diverged from dev and could no longer merge cleanly).
Type of change
What does this PR do?
On Windows, when a child process spawns grandchild processes (e.g., build tools like hvigor/Gradle daemons), the grandchild may inherit the stdout/stderr pipe handles. Even after the direct child exits, these inherited handles keep the pipe open, preventing Node.js close event from firing.
The exitCode in cross-spawn-spawner.ts was resolved only on close event, causing bash tool to hang indefinitely in Effect.raceAll waiting for handle.exitCode.
This PR adds a fallback: resolve exitCode on exit event with a 2-second delay. If close fires within 2 seconds (normal case), behavior is unchanged. If close does not fire (daemon holds pipe), fallback resolves after 2 seconds.
How did you verify your code works?
Checklist