Skip to content

[Bug]: herd-mcp.phar leaves orphaned PPID=1 processes consuming CPU/RAM #1694

@virgildotcodes

Description

@virgildotcodes

Platform

macOS

Operating system version

macOS 26.3.1 (25D771280a)

System architecture

ARM64 (M1, M2, etc)

Herd Version

1.28.0 (Build: 64)

PHP Version

PHP 8.4.20 (cli) (built: Apr 25 2026 10:44:51) (NTS), built by Laravel Herd

Bug description

herd-mcp.phar appears to leave orphaned PHP processes behind after MCP clients disconnect or are restarted. Over multiple days, this accumulated into 108-109 orphaned processes whose parent was launchd (PPID=1).

Each individual process was small, but the aggregate impact was material:

  • Process command: php /Applications/Herd.app/Contents/Resources/herd-mcp.phar
  • Orphan criteria: PPID=1
  • Count observed: 108-109 processes
  • Aggregate RSS observed: about 615-625 MB
  • Aggregate sampled CPU observed: about 67-69%
  • Many processes had been alive for 2-6+ days

Killing only the PPID=1 herd-mcp.phar processes cleared the issue. Active Herd MCP processes attached to live MCP clients were left running and continued to work.

Expected behavior: when the MCP client disconnects/exits, the Herd MCP PHP process should also terminate, or Herd should clean up stale MCP child processes so they do not accumulate under launchd.

Actual behavior: stale herd-mcp.phar PHP processes remained parented to launchd and continued consuming CPU/RAM until manually killed.

Steps to reproduce

I do not yet have a minimal deterministic reproduction, but the observed setup was:

  1. Use Herd's MCP server from a desktop AI/developer tool that repeatedly launches MCP sessions.
  2. Leave the machine running for several days while opening/closing or restarting tool sessions.
  3. Inspect the process table:
ps -axo pid,ppid,user,%cpu,rss,etime,stat,comm,args | awk '$2 == 1 && /php \/Applications\/Herd\.app\/Contents\/Resources\/herd-mcp\.phar/ {print}'
  1. Observe many stale herd-mcp.phar processes with PPID=1.

Relevant log output

# Before cleanup
$ ps -axo pid,ppid,user,%cpu,rss,etime,stat,comm,args | awk '$2 == 1 && /php \/Applications\/Herd\.app\/Contents\/Resources\/herd-mcp\.phar/ {printf "%s\n", $0; count++; cpu += $4; rss += $5} END {printf "COUNT=%d CPU=%.1f RSS_KB=%d RSS_MB=%.1f\n", count, cpu, rss, rss/1024}'

COUNT=108 CPU=69.2 RSS_KB=629632 RSS_MB=614.9

# A repeated scan saw the same pattern:
COUNT=109 CPU=67.4 RSS_KB=640032 RSS_MB=625.0

# Cleanup was limited to PPID=1 herd-mcp.phar processes:
$ pkill -P 1 -f 'php /Applications/Herd.app/Contents/Resources/herd-mcp.phar'

# After cleanup
$ ps -axo pid,ppid,user,%cpu,rss,etime,stat,comm,args | awk '$2 == 1 && /php \/Applications\/Herd\.app\/Contents\/Resources\/herd-mcp\.phar/ {print; count++} END {printf "COUNT=%d\n", count}'

COUNT=0

# Remaining Herd MCP processes were attached to active parent processes, not launchd:
TOTAL=11 PPID1=0 ATTACHED=11 CPU=0.0 RSS_MB=157.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions