openclaw - 💡(How to fix) Fix [Bug]: Gateway memory and connection accumulation over extended runtime on Windows [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#73862Fetched 2026-04-29 06:14:04
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Timeline (top)
closed ×1commented ×1

Code Example

TIME_WAIT connections: 13+
ESTABLISHED connections: 21+
LISTENING ports: 31+
RAW_BUFFERClick to expand / collapse

Describe the bug

OpenClaw Gateway process exhibits gradual memory and resource accumulation over extended runtime, leading to degraded performance and potential instability.

Observed Behavior

After extended uptime (24+ hours):

  • Single Node.js process memory usage grows to ~1GB+
  • Accumulation of TIME_WAIT network connections
  • Increased frequency of timeout errors
  • Slower response times for internal operations

Network Connection State (after extended runtime)

TIME_WAIT connections: 13+
ESTABLISHED connections: 21+
LISTENING ports: 31+

Environment

  • OS: Windows_NT 10.0.20348 (x64) / Windows Server 2019
  • Node.js: v24.14.1
  • OpenClaw: v2026.4.26
  • Deployment: Multi-agent local deployment

Impact

  • Memory pressure increases over time without bound
  • Connection pool exhaustion leads to timeout failures
  • Requires periodic Gateway restart to reclaim resources
  • Long-running production deployments are most affected

Suggested Improvements

  1. Implement connection pool management with automatic recycling
  2. Add memory usage monitoring and alerting
  3. Implement automatic garbage collection triggers
  4. Add configurable max memory thresholds with graceful degradation
  5. Periodic health checks with self-recovery capabilities

extent analysis

TL;DR

Implement connection pool management with automatic recycling to mitigate memory and resource accumulation.

Guidance

  • Investigate and implement a connection pool management strategy to reduce the accumulation of TIME_WAIT connections, such as using a library like pg with a built-in connection pool or implementing a custom pool with automatic recycling.
  • Monitor memory usage and network connections to identify the root cause of the resource accumulation and adjust the connection pool settings accordingly.
  • Consider implementing automatic garbage collection triggers to help manage memory usage, but be cautious of potential performance impacts.
  • Review the suggested improvements and prioritize implementing a combination of connection pool management, memory usage monitoring, and configurable max memory thresholds.

Example

No specific code example is provided due to the lack of detailed implementation information, but an example of connection pool management using pg might look like:

const { Pool } = require('pg');
const pool = new Pool({
  user: 'username',
  host: 'localhost',
  database: 'database',
  password: 'password',
  max: 20, // max number of connections
  idleTimeoutMillis: 30000, // close idle connections after 30 seconds
});

Notes

The provided guidance is based on the observed behavior and suggested improvements, but the actual implementation may vary depending on the specific requirements and constraints of the OpenClaw Gateway.

Recommendation

Apply a workaround by implementing connection pool management with automatic recycling, as this is a likely cause of the memory and resource accumulation and can help mitigate the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Gateway memory and connection accumulation over extended runtime on Windows [1 comments, 2 participants]