openclaw / openclaw/shellbench

Background service startup failures leak earlier processes

Open
#82 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:other issue-rating: 🦞 diamond lobster no-stale P2
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.