hermes - 💡(How to fix) Fix MCP reload/gateway restart leaks processes — old instances never killed

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Every time the gateway reloads or /reload-mcp runs, new MCP server processes are spawned but old ones are never killed. Over multiple reloads, duplicate MCP processes accumulate until the system runs out of RAM.

Error Message

  • Silent: no error, no log warning — processes just accumulate

Root Cause

Every time the gateway reloads or /reload-mcp runs, new MCP server processes are spawned but old ones are never killed. Over multiple reloads, duplicate MCP processes accumulate until the system runs out of RAM.

Fix Action

Workaround

Manual cleanup:

# Kill duplicate MCP processes (keep newest of each)
ps -eo pid,lstart,args | grep mcp-server | sort -k2,3

Code Example

Time    PID   Server         RSS     Note
19:46   1033  grocery        92MB    initial gateway start
19:46   1031  gpt-image-2    63MB    
19:46   1032  ridewithgps    45MB    
19:46   1030  github         13MB    
19:49   1486  grocery        137MB   session started (new instances)
19:49   1484  gpt-image-2    81MB    
19:49   1485  ridewithgps    60MB    
19:49   1483  github         18MB    
19:52   1645  grocery        104MB   config edit triggered reload
19:52   1637  gpt-image-2    67MB    
19:52   1629  ridewithgps    49MB    
20:31   1841  gpt-image-2    82MB   yet another reload
20:31   1842  ridewithgps    60MB    
20:31   1840  github         21MB

---

# Kill duplicate MCP processes (keep newest of each)
ps -eo pid,lstart,args | grep mcp-server | sort -k2,3
RAW_BUFFERClick to expand / collapse

Summary

Every time the gateway reloads or /reload-mcp runs, new MCP server processes are spawned but old ones are never killed. Over multiple reloads, duplicate MCP processes accumulate until the system runs out of RAM.

Reproduction

  1. Run Hermes gateway with several MCP servers configured (grocery CLI, gpt-image-2, ridewithgps, github, strava)
  2. Edit config.yaml → triggers gateway reload
  3. Observe: new MCP processes spawn, old ones stay alive

Evidence

On a 906MB AWS instance with 6 MCP servers:

Time    PID   Server         RSS     Note
19:46   1033  grocery        92MB    initial gateway start
19:46   1031  gpt-image-2    63MB    
19:46   1032  ridewithgps    45MB    
19:46   1030  github         13MB    
19:49   1486  grocery        137MB   session started (new instances)
19:49   1484  gpt-image-2    81MB    
19:49   1485  ridewithgps    60MB    
19:49   1483  github         18MB    
19:52   1645  grocery        104MB   config edit triggered reload
19:52   1637  gpt-image-2    67MB    
19:52   1629  ridewithgps    49MB    
20:31   1841  gpt-image-2    82MB   yet another reload
20:31   1842  ridewithgps    60MB    
20:31   1840  github         21MB

All 14 processes were alive simultaneously — only the 20:31 set was actually in use. The other 11 were zombie processes consuming ~400MB of RAM.

System went from 194MB available to 334MB after manually killing zombies.

Impact

  • RAM bloat: each duplicate MCP server leaks 20-140MB of RSS. With 6 servers and 3 reloads, that's ~400MB of dead processes
  • Worse with heavy MCPs: Node.js/Playwright servers (grocery CLI at 136MB) are especially painful
  • System OOM risk: on small instances (1GB), this can OOM-kill the gateway itself
  • Silent: no error, no log warning — processes just accumulate

Expected behavior

On MCP reload or gateway restart, old MCP server processes should be gracefully terminated (SIGTERM → SIGKILL after timeout) before new ones are spawned.

Workaround

Manual cleanup:

# Kill duplicate MCP processes (keep newest of each)
ps -eo pid,lstart,args | grep mcp-server | sort -k2,3

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

On MCP reload or gateway restart, old MCP server processes should be gracefully terminated (SIGTERM → SIGKILL after timeout) before new ones are spawned.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix MCP reload/gateway restart leaks processes — old instances never killed