Repository navigation
fix(daemon): prevent gateway OOM crash loops under sustained load - #96250
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed July 15, 2026, 10:49 PM ET / July 16, 2026, 02:49 UTC. Summary PR surface: Source +14, Tests +67. Total +81 across 2 files. Reproducibility: Partially yes: current source clearly reproduces the absence of a managed-service heap setting, and the linked issue contains strong live crash-loop evidence. This review did not rerun the full sustained-load failure. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Adopt the heap-only generated default only after maintainers explicitly accept its cross-platform resource and upgrade behavior, keep all ambient startup-control flags blocked, and track any durable host-specific tuning contract separately. Do we have a high-confidence way to reproduce the issue? Partially yes: current source clearly reproduces the absence of a managed-service heap setting, and the linked issue contains strong live crash-loop evidence. This review did not rerun the full sustained-load failure. Is this the best way to solve the issue? Yes technically, subject to maintainer acceptance: this is the narrowest heap-only install mitigation and avoids preserving ambient startup-control flags, but the fixed value and service scope are product-owned tradeoffs. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 04221fc91ef4. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +14, Tests +67. Total +81 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
This pull request has been automatically marked as stale due to inactivity. |
8774007 to
bfb8afc
Compare
bfb8afc to
a1b4157
Compare
b0ffa77 to
a302bc9
Compare
…rvice env Generate a managed NODE_OPTIONS with --max-old-space-size=8192 for the gateway systemd service, discarding ambient host NODE_OPTIONS to prevent --require/--inspect persistence. 8192 MB is chosen as a safe default that prevents the common OOM crash-loop with the default Node ~4 GB heap under sustained load. Related to openclaw#96203
a302bc9 to
3a7ad7a
Compare
|
Merged via squash.
|
…enclaw#96250) * [AI] fix(daemon): set default --max-old-space-size=8192 in gateway service env Generate a managed NODE_OPTIONS with --max-old-space-size=8192 for the gateway systemd service, discarding ambient host NODE_OPTIONS to prevent --require/--inspect persistence. 8192 MB is chosen as a safe default that prevents the common OOM crash-loop with the default Node ~4 GB heap under sustained load. Related to openclaw#96203 * fix(daemon): adapt gateway heap limit to host memory * fix(daemon): keep gateway heap helpers internal --------- Co-authored-by: Peter Steinberger <[email protected]>
…enclaw#96250) * [AI] fix(daemon): set default --max-old-space-size=8192 in gateway service env Generate a managed NODE_OPTIONS with --max-old-space-size=8192 for the gateway systemd service, discarding ambient host NODE_OPTIONS to prevent --require/--inspect persistence. 8192 MB is chosen as a safe default that prevents the common OOM crash-loop with the default Node ~4 GB heap under sustained load. Related to openclaw#96203 * fix(daemon): adapt gateway heap limit to host memory * fix(daemon): keep gateway heap helpers internal --------- Co-authored-by: Peter Steinberger <[email protected]>
Closes #96203
What Problem This Solves
Fixes an issue where a managed Gateway under sustained multi-agent load could exhaust Node's old-space heap, enter a rapid crash loop, and block agent workflows. The incident in #96203 reproduced this with roughly 30 agents and more than 2,000 restarts in one day; an explicit heap limit stopped the loop.
Why This Change Was Made
Managed Gateway installs now derive a heap-only
NODE_OPTIONSvalue from the smaller of Node's constrained-memory result and physical RAM. The adaptive default targets 50% of available memory, uses a 2048 MiB floor when native headroom allows, keeps 25% headroom on smaller hosts, and caps old space at 8192 MiB.The policy applies only to the Gateway service because the reported failure and evidence are Gateway-specific. Node services remain unchanged. A heap-size flag already present in the installed service is preserved and normalized, while ambient or adjacent startup flags such as preload and inspector options remain blocked. No config key, CLI flag, or public environment knob is added.
User Impact
After Gateway service installation or regeneration, operators get a host-appropriate old-space limit instead of relying on Node's generic default.
openclaw gateway statusandopenclaw doctorshow the applied limit and its derivation, including whether the installed service uses a distinct explicit setting.Release note: Managed Gateway services now use a constrained-memory-aware Node heap limit to prevent sustained-load OOM crash loops.
Evidence
node scripts/run-vitest.mjsacross heap math/parser, service environment, install planning, status gather/print, and doctor suites — 254 tests passed.NODE_OPTIONSis ignored, only an installed heap-size flag is retained, quoted Node-compatible values are normalized, and node services receive no Gateway heap default.