Environment
- OpenClaw version: 2026.2.22-2
- Node.js: v24.13.1
- OS: Ubuntu Linux 6.8.0-100-generic (x64)
- Host: VPS with ~8GB RAM
Issue
The openclaw-gateway service reached 6.0 GB peak memory (as reported by systemd memory peak) after only ~26 minutes of runtime. This is abnormally high for a gateway process.
Timeline
- Gateway started at 17:24:42 UTC (PID 21315)
- Normal operation: Telegram message routing, agent sessions (Claude Opus), tool calls (exec, memory_search)
- SIGTERM received at 17:50:34 UTC (systemd stop)
- systemd reported:
Consumed 1min 15.038s CPU time, 6.0G memory peak, 0B memory swap peak
Additional observations
- After shutdown, orphaned child processes remained (
bash, systemctl), preventing clean restart
- systemd attempted 6 restarts that all failed with
gateway already running (pid XXXX); lock timeout after 5000ms and Port 18789 is already in use
- The stale process eventually exited, and the 7th restart succeeded
- A subsequent shorter session (~12 min) peaked at 1.0 GB
Possible causes
- Large context accumulation in agent sessions (Opus model with full system prompts + workspace files + tool results)
- Exec tool subprocess output buffering (large strings held in memory)
- Child process cleanup not fully handled on SIGTERM
Workaround
Added MemoryHigh=1536M and MemoryMax=2G to the systemd unit.
Logs
Feb 23 18:50:34 erebus node[21315]: 2026-02-23T17:50:34.728Z [gateway] signal SIGTERM received
Feb 23 18:50:34 erebus node[21315]: 2026-02-23T17:50:34.731Z [gateway] received SIGTERM; shutting down
Feb 23 18:50:35 erebus systemd[3281]: openclaw-gateway.service: Unit process 21922 (bash) remains running after unit stopped.
Feb 23 18:50:35 erebus systemd[3281]: openclaw-gateway.service: Unit process 21923 (systemctl) remains running after unit stopped.
Feb 23 18:50:35 erebus systemd[3281]: openclaw-gateway.service: Consumed 1min 15.038s CPU time, 6.0G memory peak, 0B memory swap peak.
Environment
Issue
The openclaw-gateway service reached 6.0 GB peak memory (as reported by systemd
memory peak) after only ~26 minutes of runtime. This is abnormally high for a gateway process.Timeline
Consumed 1min 15.038s CPU time, 6.0G memory peak, 0B memory swap peakAdditional observations
bash,systemctl), preventing clean restartgateway already running (pid XXXX); lock timeout after 5000msandPort 18789 is already in usePossible causes
Workaround
Added
MemoryHigh=1536MandMemoryMax=2Gto the systemd unit.Logs