Bash tool timeout does not terminate the child process tree — orphaned processes keep running indefinitely

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 30, 2026

Environment: Claude Code v2.1.251 (VS Code extension host), Windows 11, Git Bash as the Bash tool shell.

Behavior: When a Bash tool invocation hits its timeout (default 120 s), the tool returns a timeout error to the model, but child processes spawned by the command line (e.g. find, grep in a pipeline) are not killed — only abandoned. On Windows we observed 21 orphaned find.exe / grep.exe processes (parent PID no longer existing) from timed-out agent/subagent Bash calls, each continuing to crawl a ~1M-file workspace to completion. Combined effect: Windows Defender real-time scanning of their file opens held ~50% of a 16-core machine for hours. Killing the orphans dropped it to 4% immediately.

Expected: Timeout (and tool-call cancellation) should terminate the entire process tree — on Windows via a Job Object or taskkill /T /F on the shell PID; on POSIX via killing the process group.

Repro: In a large directory tree, run a Bash tool call like find / -iname something-rare with a short timeout; after the tool reports timeout, observe the find process still running with a dead parent.

Impact: Every subagent-heavy session accumulates orphans; the cost is invisible to the model (it only sees the timeout) and lands as machine-wide CPU/AV load.

View original on GitHub ↗