Skip to content

agent_servers: Fix process leaks after terminating ACP server#45902

Merged
bennetbo merged 4 commits intomainfrom
fix-acp-subprocess-leaks
Dec 31, 2025
Merged

agent_servers: Fix process leaks after terminating ACP server#45902
bennetbo merged 4 commits intomainfrom
fix-acp-subprocess-leaks

Conversation

@bennetbo
Copy link
Member

@bennetbo bennetbo commented Dec 31, 2025

Closes #45211

This ensures that all sub-processes that were launched by the ACP server are terminated. One scenario where this is easily reproducible:

  • Start a new Claude Code ACP session
  • Submit a prompt
  • While Claude-code is still responding, start a new session
  • The claude-code subprocess is leaked from the previous session (The Claude-code SDK runs the Claude-code binary in a sub process)

This PR fixes this by using process groups on Unix.
It does not fix the process leaks on Windows yet (will follow up with another PR)

Release Notes:

  • Fixed an issue where subprocesses of ACP servers could be leaked after starting a new session

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 31, 2025
@bennetbo bennetbo changed the title Fix acp subprocess leaks agent_servers: Fix process leaks after terminating ACP server Dec 31, 2025
@bennetbo bennetbo marked this pull request as ready for review December 31, 2025 11:50
@bennetbo bennetbo enabled auto-merge (squash) December 31, 2025 11:53
@bennetbo bennetbo merged commit 9f59946 into main Dec 31, 2025
26 checks passed
@bennetbo bennetbo deleted the fix-acp-subprocess-leaks branch December 31, 2025 11:59
rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
Closes #45211

This ensures that all sub-processes that were launched by the ACP server
are terminated. One scenario where this is easily reproducible:
- Start a new Claude Code ACP session
- Submit a prompt
- While Claude-code is still responding, start a new session
- The `claude-code` subprocess is leaked from the previous session (The
Claude-code SDK runs the Claude-code binary in a sub process)

This PR fixes this by using process groups on Unix. 
It does not fix the process leaks on Windows yet (will follow up with
another PR)

Release Notes:

- Fixed an issue where subprocesses of ACP servers could be leaked after
starting a new session
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…dustries#45902)

Closes zed-industries#45211

This ensures that all sub-processes that were launched by the ACP server
are terminated. One scenario where this is easily reproducible:
- Start a new Claude Code ACP session
- Submit a prompt
- While Claude-code is still responding, start a new session
- The `claude-code` subprocess is leaked from the previous session (The
Claude-code SDK runs the Claude-code binary in a sub process)

This PR fixes this by using process groups on Unix. 
It does not fix the process leaks on Windows yet (will follow up with
another PR)

Release Notes:

- Fixed an issue where subprocesses of ACP servers could be leaked after
starting a new session
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…dustries#45902)

Closes zed-industries#45211

This ensures that all sub-processes that were launched by the ACP server
are terminated. One scenario where this is easily reproducible:
- Start a new Claude Code ACP session
- Submit a prompt
- While Claude-code is still responding, start a new session
- The `claude-code` subprocess is leaked from the previous session (The
Claude-code SDK runs the Claude-code binary in a sub process)

This PR fixes this by using process groups on Unix. 
It does not fix the process leaks on Windows yet (will follow up with
another PR)

Release Notes:

- Fixed an issue where subprocesses of ACP servers could be leaked after
starting a new session
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
…dustries#45902)

Closes zed-industries#45211

This ensures that all sub-processes that were launched by the ACP server
are terminated. One scenario where this is easily reproducible:
- Start a new Claude Code ACP session
- Submit a prompt
- While Claude-code is still responding, start a new session
- The `claude-code` subprocess is leaked from the previous session (The
Claude-code SDK runs the Claude-code binary in a sub process)

This PR fixes this by using process groups on Unix. 
It does not fix the process leaks on Windows yet (will follow up with
another PR)

Release Notes:

- Fixed an issue where subprocesses of ACP servers could be leaked after
starting a new session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Gemini ACP extension leaks multiple zombie processes causing memory exhaustion (Not reproducible with Codex/Claude)

1 participant