Gateway startup takes 4-10 minutes (603 JS chunks, 2.2GB memory peak)
Summary
Gateway takes ~4 minutes on warm restart and ~10 minutes on cold boot before it begins accepting connections. During startup, Node.js consumes up to 2.2GB of memory and produces no log output — it appears to be parsing/compiling the JS bundle.
Environment
- OpenClaw version: 2026.3.14
- Node.js: v22.22.0
- OS: Ubuntu 24.04 VM, Linux 6.17, x86_64
- Resources: 4 vCPU, 32GB RAM, SSD-backed storage
- Install method: source (git clone + pnpm install + pnpm build)
- Service manager: systemd (user unit)
Bundle stats
dist/: 603 JS files, 69MB total
node_modules/: 2.5GB
Workload
- 8 cron jobs
- 5 channel sessions (Discord + WhatsApp)
- 57 total sessions (1.5MB sessions.json)
- Browser relay enabled
Observed behavior
Warm restart (disk cache hot)
18:58:09 systemd starts node process
19:02:14 first gateway log line (canvas mounted, heartbeat started)
~4 minutes of silence between process start and first output.
Cold boot (after VM reboot)
18:18:10 systemd starts node process
18:28:15 first gateway log line
~10 minutes of silence.
Memory
- Peak memory during startup: 2.2GB (reported by systemd
MemoryPeak)
- At default Node.js heap limit (~1.7GB), the gateway OOM crashes during startup or under load:
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
- The OOM occurs during
JSON.parse in the V8 stack trace
- Workaround:
--max-old-space-size=4096
Systemd restart counter
The service has OOM-crashed and auto-restarted 5 times over ~2 weeks of operation.
Expected behavior
Gateway should start in under 30 seconds. 603 separate JS chunks seems high — a single bundled entry point would dramatically reduce module resolution and V8 compilation overhead.
Workaround
Setting --max-old-space-size=4096 in the systemd service prevents OOM crashes but doesn't improve startup time.
Questions
- Is the 603-chunk dist layout intentional (code splitting for lazy loading)?
- Are there plans for a single-file bundle or V8 snapshot to improve cold start?
- Is 2.2GB memory at startup expected, or could there be a memory leak during initialization?
Additional context
- Once running, the gateway performs well and memory stabilizes
- Warm restarts (SIGUSR1 config reload) within a running process are fast — it's only full process restarts that are slow
- The session state is small (57 sessions, 1.5MB) so this doesn't appear to be data-related
Gateway startup takes 4-10 minutes (603 JS chunks, 2.2GB memory peak)
Summary
Gateway takes ~4 minutes on warm restart and ~10 minutes on cold boot before it begins accepting connections. During startup, Node.js consumes up to 2.2GB of memory and produces no log output — it appears to be parsing/compiling the JS bundle.
Environment
Bundle stats
Workload
Observed behavior
Warm restart (disk cache hot)
~4 minutes of silence between process start and first output.
Cold boot (after VM reboot)
~10 minutes of silence.
Memory
MemoryPeak)JSON.parsein the V8 stack trace--max-old-space-size=4096Systemd restart counter
The service has OOM-crashed and auto-restarted 5 times over ~2 weeks of operation.
Expected behavior
Gateway should start in under 30 seconds. 603 separate JS chunks seems high — a single bundled entry point would dramatically reduce module resolution and V8 compilation overhead.
Workaround
Setting
--max-old-space-size=4096in the systemd service prevents OOM crashes but doesn't improve startup time.Questions
Additional context