openclaw - 💡(How to fix) Fix Gateway infinite loop during initialization on v2026.4.23+ (CPU 100%+, never reaches HTTP bind) [2 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#72505Fetched 2026-04-28 06:35:08
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Timeline (top)
commented ×2closed ×1subscribed ×1

OpenClaw gateway enters an infinite loop during startup on versions v2026.4.23 and v2026.4.24, consuming 100%+ CPU and never reaching the HTTP bind phase. The issue is not plugin-related and occurs even with a minimal configuration.

Root Cause

Root Cause Analysis

Fix Action

Fix / Workaround

Workarounds

  • None available — the bug is in compiled dist/ code
  • Rollback to v2026.4.9 is the only remediation

Code Example

[gateway] loading configuration…
[gateway] resolving authentication…
[gateway] starting...
# ... process hangs here, never reaches "starting HTTP server..."

---

~/.openclaw/logs/stability/openclaw-stability-*-unhandled_rejection.json

---

openat(AT_FDCWD, "/.../node_modules/openclaw/package.json", O_RDONLY|O_CLOEXEC) = 24
read(24, "{\n  \"name\": \"openclaw\",\n  \"versi\"...", 8192) = 8192
read(24, "...", 8192) = 8192
# ... reads entire 72KB file ...
read(24, "", 8192) = 0
close(24) = 0
# Immediately reopens same file
openat(AT_FDCWD, "/.../node_modules/openclaw/package.json", O_RDONLY|O_CLOEXEC) = 24

---

{
  "plugins": {
    "entries": {
      "googlechat": { "enabled": true }
    }
  }
}

---

# Environment: Linux x64, Node v22.22.0
npm install -g openclaw@2026.4.24

# Ensure clean state
pkill -9 -f "openclaw-gateway"
rm -f ~/.openclaw/.gateway.lock

# Even with minimal config:
cat > ~/.openclaw/openclaw.json << 'EOF'
{
  "plugins": {
    "entries": {
      "googlechat": { "enabled": true }
    }
  }
}
EOF

# Start gateway
openclaw gateway --port 18789

# Observe: process consumes 100%+ CPU, port never opens
RAW_BUFFERClick to expand / collapse

Bug Report: Gateway Infinite Loop During Initialization on v2026.4.23+

Summary

OpenClaw gateway enters an infinite loop during startup on versions v2026.4.23 and v2026.4.24, consuming 100%+ CPU and never reaching the HTTP bind phase. The issue is not plugin-related and occurs even with a minimal configuration.

Affected Versions

  • 2026.4.24 (cbcfdf6)
  • 2026.4.23 (a979721)
  • 2026.4.9 (0512059) — last known good

Environment

  • OS: Linux x64 (RHEL 9)
  • Node.js: v22.22.0 (via nvm)
  • OpenClaw Install: npm install -g
  • Gateway Port: 18789
  • Agents: 10 active agents

Symptoms

1. Process Behavior

  • Gateway parent (openclaw) starts normally
  • Gateway child (openclaw-gateway) immediately consumes 100-160% CPU
  • Process state: Rl (running, multithreaded) or Dl (disk sleep)
  • Never transitions to HTTP server bind phase
  • Port 18789 is never opened

2. systemd Behavior

  • systemd restarts gateway repeatedly (observed NRestarts=45+)
  • Lock file conflicts: "gateway already running (pid X); lock timeout after 5000ms"
  • Port conflicts if old process hasn't exited

3. Log Pattern

[gateway] loading configuration…
[gateway] resolving authentication…
[gateway] starting...
# ... process hangs here, never reaches "starting HTTP server..."

4. Stability Bundles

Multiple unhandled_rejection stability bundles generated:

~/.openclaw/logs/stability/openclaw-stability-*-unhandled_rejection.json

Root Cause Analysis

V8 CPU Profiler Evidence

Collected via node --prof during the hang:

FunctionFileTicks%
parsejson5/lib/parse.js:13671.7%
defaultjson5/lib/parse.js:133631.6%
stringjson5/lib/parse.js:570401.0%
resolvePackageRuntimeExtensionEntriesdist/discovery-DmIzxmAL.js:4891
resolveBundledPluginsDirdist/bundled-dir-DXKS8sgC.js:591

strace Evidence

The gateway child process repeatedly opens and reads the package.json file in an infinite loop:

openat(AT_FDCWD, "/.../node_modules/openclaw/package.json", O_RDONLY|O_CLOEXEC) = 24
read(24, "{\n  \"name\": \"openclaw\",\n  \"versi\"...", 8192) = 8192
read(24, "...", 8192) = 8192
# ... reads entire 72KB file ...
read(24, "", 8192) = 0
close(24) = 0
# Immediately reopens same file
openat(AT_FDCWD, "/.../node_modules/openclaw/package.json", O_RDONLY|O_CLOEXEC) = 24

Isolation Tests

The bug was confirmed not to be plugin-related by testing with a minimal configuration:

{
  "plugins": {
    "entries": {
      "googlechat": { "enabled": true }
    }
  }
}

Result: Same infinite loop (CPU 114%, process never starts HTTP server).

Diagnosis

The function resolvePackageRuntimeExtensionEntries in dist/discovery-DmIzxmAL.js enters infinite recursion while resolving the exports map from package.json during plugin/bundled module discovery. Each recursive call re-parses the 72KB package.json via json5, creating the observed I/O loop.

This likely relates to the changelog entry:

"Fixes Jiti loading of plugins with file:// scheme" (v2026.4.10)

The Jiti plugin loader fix may have introduced a recursive path resolution that doesn't terminate when processing the complex exports map in OpenClaw's package.json.

Impact

  • Production systems cannot upgrade beyond v2026.4.9
  • systemd enters restart storm (45+ restarts observed)
  • All agents become unreachable via webhooks
  • CPU saturation affects co-hosted services

Workarounds

  • None available — the bug is in compiled dist/ code
  • Rollback to v2026.4.9 is the only remediation

Reproduction Steps

# Environment: Linux x64, Node v22.22.0
npm install -g [email protected]

# Ensure clean state
pkill -9 -f "openclaw-gateway"
rm -f ~/.openclaw/.gateway.lock

# Even with minimal config:
cat > ~/.openclaw/openclaw.json << 'EOF'
{
  "plugins": {
    "entries": {
      "googlechat": { "enabled": true }
    }
  }
}
EOF

# Start gateway
openclaw gateway --port 18789

# Observe: process consumes 100%+ CPU, port never opens

Recommended Fix

Review resolvePackageRuntimeExtensionEntries in the discovery module to add:

  1. Recursion depth limit when resolving exports map
  2. Memoization/caching of already-resolved package paths
  3. Cycle detection in package.json exports resolution

Attachments

  • V8 profiler output: v8.log (available on request)
  • strace capture: gateway.strace (available on request)
  • Stability bundles: ~/.openclaw/logs/stability/*.json

Date: 2026-04-26 Severity: Critical (breaks production upgrades)

extent analysis

TL;DR

The most likely fix for the OpenClaw gateway infinite loop issue is to review and modify the resolvePackageRuntimeExtensionEntries function in the discovery module to prevent infinite recursion.

Guidance

  1. Review the resolvePackageRuntimeExtensionEntries function: Inspect the code to understand how it resolves the exports map from package.json and identify potential causes of infinite recursion.
  2. Implement recursion depth limit: Add a limit to the number of recursive calls to prevent the function from entering an infinite loop.
  3. Add memoization or caching: Cache already-resolved package paths to avoid redundant resolutions and reduce the likelihood of infinite recursion.
  4. Detect cycles in package.json exports resolution: Implement a mechanism to detect and prevent cycles in the exports map resolution to prevent infinite loops.

Example

// Pseudocode example of modified resolvePackageRuntimeExtensionEntries function
function resolvePackageRuntimeExtensionEntries(packageJson, exportsMap, recursionDepth = 0, maxRecursionDepth = 10) {
  if (recursionDepth > maxRecursionDepth) {
    throw new Error('Recursion depth limit exceeded');
  }
  // ... resolve exports map logic ...
  // Cache resolved package paths
  const cache = {};
  if (cache[packageJson.name]) {
    return cache[packageJson.name];
  }
  // ... resolve logic ...
  cache[packageJson.name] = resolvedPackagePath;
  return resolvedPackagePath;
}

Notes

The provided guidance is based on the information available in the issue report and may not be a comprehensive solution. Additional debugging and testing may be required to fully resolve the issue.

Recommendation

Apply the workaround by rolling back to version v2026.4.9 until a fixed version is available, as the bug is in compiled dist/ code and no other workarounds are available.

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 Gateway infinite loop during initialization on v2026.4.23+ (CPU 100%+, never reaches HTTP bind) [2 comments, 2 participants]