Skip to content

Worker PID file not validated against process identity, causes permanent ghost-PID deadlock on Windows #2726

@StealthyRepro

Description

@StealthyRepro

When the worker process is killed uncleanly (e.g. mid-session usage limit, system crash, forced shutdown), the PID file at ~/.claude-mem/worker.pid is not cleaned up. On subsequent starts, the plugin checks if the recorded PID is "alive" using Windows process existence — but Windows can and does reuse PIDs for unrelated processes. In my case, PID 8016 was reused by BrLogRx.exe (Brother printer driver).

The plugin sees a live process at that PID, assumes the worker is already running, refuses to spawn a new one, then times out waiting for port 37777 to open. This loops indefinitely, and because the UserPromptSubmit hook is blocked on worker reachability, Claude Code becomes completely unusable — all prompts are blocked.

Steps to reproduce:

  1. Run Claude Code on Windows with claude-mem installed
  2. Hit a mid-session interruption that kills the worker without cleanup (usage limit, crash, etc.)
  3. Reopen Claude Code — hooks will immediately start reporting worker unreachable for N consecutive hooks
  4. npm run worker:status shows not running, but logs show Worker already running (PID alive), refusing to start duplicate

Expected behaviour: The plugin should validate that the PID belongs to its own worker process (e.g. by checking process name, querying the health endpoint, or storing a session token alongside the PID) before trusting it.

Workaround: Manually delete ~/.claude-mem/worker.pid and run npm run worker:start.

Environment: Windows 11, Node v24.13.1, claude-mem v13.4.0, Bun

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions