-
-
Notifications
You must be signed in to change notification settings - Fork 80.3k
[Bug]: gateway heap grows unbounded over time, gets killed by cgroup OOM on long-running Linux systemd --user deployments #89315
Copy link
Copy link
Open
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:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.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.
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:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.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.
Type
Fields
No fields configured for issues without a type.
[Bug]: gateway heap grows unbounded over time, gets killed by cgroup OOM on long-running Linux systemd --user deployments
Environment
(
~/.config/systemd/user/openclaw-gateway.service) withLinger=yes; noMemoryMax/MemoryHighset on the cgroupv2026.5.28 upgrade; gateway had not been manually restarted in
that window.
Summary
After ~5 days of steady traffic, the gateway Node process heap grew
to ~1.6 GB (
heapUsedBytes ≈ 1.5 GB,rssBytes ≈ 1.64 GB) and waskilled by
systemd-oomdbecause its cgroup'smemory.pressurecrossed the kernel's kill threshold:
The gateway exposed no built-in heap bound, so with the
kernel-default cgroup limit it was effectively unbounded.
Observed timeline (local journal, UTC+8)
memory-core: managed dreaming cron could not be reconciled (cron service unavailable)[diagnostics/memory] memory pressure: level=warning reason=heap_threshold rssBytes=1403424768 heapUsedBytes=1341035200 thresholdBytes=1073741824[diagnostics/memory] memory pressure: level=warning reason=rss_threshold rssBytes=1642409984 heapUsedBytes=1546413600 thresholdBytes=1610612736systemd-journald[431]: Under memory pressure, flushing caches.systemd-oomd[918]: Considered 16 cgroups for killing, top candidates were: /user.slice/user-<UID>.slice/user@<UID>.service/app.slice/openclaw-gateway.service, Memory Pressure Limit: 0.00%, Pressure: Avg10: 83.12 Avg60: 33.06 Avg300: 8.24 Total: 1min 9s, Current Memory Usage: 234.8M, Pgscan: 5184818nodeprocess exited; no further log lines from that PID.(UID is shown as
<UID>in this report; on the affected host itcorresponds to the regular non-root user that owns the user-level
systemd service.)
Observations
[diagnostics/memory]emitted warnings atthe 1 GB and 1.6 GB thresholds, but it has no auto-mitigation
path — no graceful restart, no heap cap, no session shedding, no
alert escalation. The process kept growing until the kernel
cgroup OOM killer stepped in.
user@<UID>.service) survivedthe gateway kill (Linger=yes), but its dbus effectively became
unresponsive.
journalctl --user -u openclaw-gatewayhas noentries for the same window because the user-level journal ring
buffer was on the same memory-starved path.
recommended
MemoryHigh/MemoryMax, any long-running Linuxsystemd --user deployment with non-trivial traffic will
eventually be killed by the kernel.
[model-fetch]request/response logs fromlog.infotolog.debug(tracked separately as model-fetch logs lost in v2026.5.28 — degraded from log.info to log.debug behind env flag #89300). At the default loglevel these no longer appear in
gateway.log, which made itmuch harder to identify the request pattern that correlated
with the heap growth in this incident.
Reproduction
Linger=yes.channel bridges, periodic cron / heartbeat jobs, a few agents,
some dreaming cycles.
nodeprocess RSS climb past 1 GB and never reclaimeven after traffic stops. The only signal is the internal
[diagnostics/memory]warning.briefly),
systemd-oomdselects the gateway cgroup firstbecause
Pressure.Avg10is well above 50% and the gatewayitself is the dominant Pss on the box, then SIGKILLs it.
Expected
One of the following:
configured threshold, cap heap size, shed idle sessions /
dreaming transcripts, or refuse new work and alert).
MemoryHigh/MemoryMaxvalue(and documents it in the systemd unit template) so operators
can set a sane bound before the kernel kills the process.
[diagnostics/memory]warnings escalate (e.g. emit a CRITICALlevel, trigger a graceful shutdown, or push to a health
endpoint) instead of just logging a
warningthat nothing actson.
Actual
graceful shutdown (in-flight sessions lost, all user-level
channel bridges offline).
required a fresh interactive ssh/login for the kernel to start
a new
user@<UID>.serviceand reattach the Linger session,which then brought the gateway back.
Workaround (until fixed)
Operators can put a cgroup bound on the service manually. In
~/.config/systemd/user/openclaw-gateway.service:After
systemctl --user daemon-reload, the gateway will beSIGKILL'd by the cgroup at 2 GB and
Restart=alwayswill bringit back, but this still loses in-flight sessions and is a
band-aid — the underlying heap growth has no upper bound.
A weekly
systemctl --user restart openclaw-gateway(e.g. viaOnCalendar=weeklyin a user timer) also keeps the heap smallenough to avoid
systemd-oomdbeing triggered by transientsystem memory pressure.
Thanks for the work on
[diagnostics/memory]— the warning at1 GB was what pointed us at this. The missing piece is the
auto-mitigation (or at least a published
MemoryHighdefault)and the fact that the user-level systemd manager can't recover
on its own after a cgroup OOM kill.