openclaw / openclaw/shellbench
Background service startup failures leak earlier processes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 139
- Forks
- 30
- Avg merge
- 7m
- Merged PRs (30d)
- 6
Description
Starting a task with multiple background services can leak processes when a later service fails to start. start_background_services only stops the service whose readiness check fails; it loses all earlier services when it raises. Failures before the readiness check (invalid cwd or Popen) do not clean earlier services either. asyncio.CancelledError bypasses the existing except Exception entirely.
Reproduced on current main 2196130 with real synthetic exec sleep 30 children and injected second-service cwd, spawn, readiness, and cancellation failures. All four regression cases leave at least one child alive. The fixtures forcibly reap their children afterward.
The startup function should own every process it starts until it successfully returns the complete service list, clean that list on all failure/cancellation paths, and close its duplicate log handles after spawning. A small repair with regression coverage is prepared.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at start_background_services and reproduce the four reported second-service failures: invalid cwd, spawn failure, readiness failure, and cancellation, using the synthetic exec sleep 30 children described in the issue. Done means every process started during failed startup is cleaned up, cancellation is handled, and duplicate log handles are closed after spawning; add regression coverage for these cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100