github thedotmack/claude-mem v9.0.8

latest release: v9.0.9
6 hours ago

Fix: Prevent Zombie Process Accumulation (Issue #737)

This release fixes a critical issue where Claude haiku subprocesses spawned by the SDK weren't terminating properly, causing zombie process accumulation. One user reported 155 processes consuming 51GB RAM.

Root Causes Addressed

  • SDK's SpawnedProcess interface hides subprocess PIDs
  • deleteSession() didn't verify subprocess exit
  • abort() was fire-and-forget with no confirmation
  • No mechanism to track or clean up orphaned processes

Solution

  • ProcessRegistry module: Tracks spawned Claude subprocesses via PID
  • Custom spawn: Uses SDK's spawnClaudeCodeProcess option to capture PIDs
  • Signal propagation: Passes signal parameter to enable AbortController integration
  • Graceful shutdown: Waits for subprocess exit in deleteSession() with 5s timeout
  • SIGKILL escalation: Force-kills processes that don't exit gracefully
  • Orphan reaper: Safety net running every 5 minutes to clean up any missed processes
  • Race detection: Warns about multiple processes per session (race condition indicator)

Files Changed

  • src/services/worker/ProcessRegistry.ts (new): PID registry and reaper
  • src/services/worker/SDKAgent.ts: Use custom spawn to capture PIDs
  • src/services/worker/SessionManager.ts: Verify subprocess exit on delete
  • src/services/worker-service.ts: Start/stop orphan reaper

Full Changelog: v9.0.7...v9.0.8

Fixes #737

Don't miss a new claude-mem release

NewReleases is sending notifications on new releases.