-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Gateway memory leak: 389MB → 14.7GB over 4 days with session accumulation #54155
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Description
The
openclaw-gatewayprocess leaks memory steadily over multi-day uptime, growing from ~389MB at startup to 14.7GB (58% of 24GB RAM on Mac Mini) after approximately 4 days of continuous operation.Environment
codingObserved behavior
compaction.mode: "safeguard"withmaxHistoryShare: 0.5and 131K context window means sessions can accumulate ~65K tokens before compaction triggerscache-ttl, TTL 6h) does not appear to reclaim in-process memory after pruningLikely contributing factors
structuredClonein session store cache may be related (see perf: structuredClone in session store cache causes native memory leak (~1GB/min) #45438)seqByRunMap growth (see Memory leak: seqByRun Map in agent-events.ts grows unbounded #51819) may compound thisSteps to reproduce
ps aux | grep openclaw-gateway | awk '{print $6/1024 "MB"}'Workaround
We implemented a daily maintenance LaunchAgent that:
.reset.*files > 3 daysmaxHistoryShare: 0.3, pruning TTL2h,keepLastAssistants: 2This keeps memory under control but doesn't fix the underlying leak.
Expected behavior
Gateway RSS should plateau or return memory after session compaction/pruning, not grow unboundedly. Completed subagent sessions should be evicted from memory.