-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Gateway event loop starvation and HTTP/WS outage during sessions usage/cost under memory pressure #86718
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: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.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.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.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
We observed a recurrent OpenClaw Gateway outage where the dashboard became unreachable and the local HTTP server stopped responding while the Gateway process was still running.
This looks related to heavy
sessions.usage/sessions.costprocessing combined with high Gateway memory usage. The likely failure mode is event loop starvation plus aggressive GC pauses under memory pressure.Environment
2026.5.22http://127.0.0.1:18789184 sessions x 9 storesIncident 1
2026-05-25 00:55 UTC17985 ms2561 ms0.815sessions.usagecalls were observed taking up to about298sIncident 2
2026-05-26 01:09 UTCto about01:14 UTC1006curl --max-time 5 http://127.0.0.1:18789/timed outstatus --deepdid not return while the event loop appeared blocked1.75 GB1.5 GB[diagnostics/memory] memory pressure: level=warning rssBytes=1752862720 thresholdBytes=1610612736[ws] closed before connect code=1006status 408A manual Gateway restart immediately restored service.
Before restart:
1.75 GBstatus --deep: blocked / no responseAfter restart:
922 MB200 OK142 ms32 ms, p99 about21 ms, utilization about0.058Expected behavior
Heavy usage/cost computation should not block the Gateway's main event loop long enough to make HTTP and WebSocket unavailable.
The dashboard and gateway health endpoints should remain responsive, even if usage/cost computation is slow or has to be degraded, cached, paginated, cancelled, or moved off the main thread.
Actual behavior
During usage/cost related processing and high memory pressure, the Gateway can become effectively unavailable:
1006status --deepcan hangMitigation applied locally
We installed a temporary preventive daily systemd user timer to restart
openclaw-gateway.serviceat08:00 UTC/04:00 Martinique, because the issue appeared roughly daily with Gateway uptime and memory growth.This is only a workaround. The actual fix likely needs to be in OpenClaw runtime behavior.
Suggested fixes / guardrails
sessions.usage/sessions.costheavy work off the Gateway main event loop, or run it in bounded chunks.Impact
This caused dashboard unavailability and temporary degradation of connected integrations. Manual restart recovered the instance, but recurrence is likely without mitigation when memory grows and usage/cost computation is triggered.