buzz-acp: openclaw-acp grandchild subprocesses leak after every turn
- Dominant language
- Rust
- Stars
- 32.7k
- Forks
- 4.3k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 253
Description
### Bug: `openclaw acp` grandchild subprocesses leak after every turn
**Symptom:** When `buzz-acp` runs `openclaw acp` as the agent backend, every completed turn leaves an orphaned `openclaw-acp` process behind (reparented to PID 1). After a day of use these accumulate into the hundreds (~20 MB RSS each), exhausting RAM and swap and eventually causing the agent to be killed.
**Observed:** 318 orphaned `openclaw-acp` processes (~6.4 GB RSS total) with PPID=1, on macOS, OpenClaw 2026.6.10, `buzz-acp` from this repo. One new orphan appears per turn.
**Root cause (hypothesis):** `buzz-acp` spawns its direct child (`openclaw`) with `process_group(0)` (`acp.rs`) and on cleanup kills only that process group via `kill_process_group(pid)` (`acp.rs:2227`). But `openclaw` (the Node ACP bridge) spawns its **own** child `openclaw-acp` per session, and that grandchild gets its **own** process group (verified: PGID differs from its parent `openclaw`). So when `buzz-acp` kills `openclaw`, the grandchild `openclaw-acp` survives, is reparented to init, and is never reaped.
**Process tree observed on a live system:**
```
buzz-acp (PGID A)
└── openclaw (PGID A) ← direct child, killed by kill_process_group
└── openclaw-acp (PGID B) ← grandchild, own PGID → orphaned
```
**Reproduction:** Run `buzz-acp --agent-command openclaw --agent-args acp,...` and complete a few turns; count `ps -eo pid,ppid,command | grep openclaw-acp` with PPID=1.
**Suggested fix:** Recursively kill descendant process groups (or have the ACP bridge reuse/reap its session subprocess), so grandchildren aren't orphaned when the direct child is terminated.
Happy to provide more detail or test a proposed patch.
Contributor guide
Research direction
Start in acp.rs, especially the process_group(0) setup and cleanup around line 2227 using kill_process_group(pid). Reproduce with the documented buzz-acp command, then inspect the process tree and ps output after several turns; done means descendant openclaw-acp processes are not left orphaned after cleanup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100