openclaw - 💡(How to fix) Fix MCP Server Memory Leak - zombie processes accumulate [1 comments, 2 participants]

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…
GitHub stats
openclaw/openclaw#71610Fetched 2026-04-26 05:10:40
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Participants
Timeline (top)
closed ×1commented ×1

Root Cause

Gateway's MCP tool handler does not properly reap forked child processes.

Code Example

ps aux | grep mcp-tfs-query | grep -v grep | wc -l
# Run any TFS MCP tool multiple times, then check again

---

pkill -f mcp-tfs-query
RAW_BUFFERClick to expand / collapse

Environment

  • OS: Linux 6.8.0
  • Memory: 3.6GB
  • OpenClaw: 2026.4.8

Problem

When calling mcp-tfs-query tools, gateway forks node child processes. Each invocation creates a new process, but they are not properly cleaned up after exit, accumulating into zombie processes.

Reproduction

ps aux | grep mcp-tfs-query | grep -v grep | wc -l
# Run any TFS MCP tool multiple times, then check again

Impact

  • Single node process: ~85MB
  • 18 processes accumulated: ~1.5GB
  • Swap filled (1.9GB/1.9GB), system becomes sluggish

Temporary Fix

pkill -f mcp-tfs-query

Root Cause

Gateway's MCP tool handler does not properly reap forked child processes.

extent analysis

TL;DR

The most likely fix is to modify the Gateway's MCP tool handler to properly reap forked child processes.

Guidance

  • Investigate the Gateway's MCP tool handler code to identify the issue with reaping child processes.
  • Consider using a mechanism like waitpid or a process group to manage and clean up child processes.
  • Verify the fix by running the reproduction steps and checking for zombie processes using ps aux | grep defunct.
  • To mitigate the issue temporarily, use the provided pkill -f mcp-tfs-query command to clean up accumulated processes.

Example

# Example of using waitpid to reap a child process
pid=$!
wait $pid

Notes

The provided temporary fix using pkill may not be suitable for production use, as it may terminate processes unexpectedly. A proper fix should be implemented in the Gateway's MCP tool handler.

Recommendation

Apply a workaround by modifying the Gateway's MCP tool handler to properly reap child processes, as the root cause is identified and a temporary fix is available.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix MCP Server Memory Leak - zombie processes accumulate [1 comments, 2 participants]