openclaw - 💡(How to fix) Fix 🐛 TUI freezes on startup — Node.js event loop blocking (100%+ CPU) [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#75291Fetched 2026-05-01 05:35:41
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Author
Timeline (top)
closed ×1commented ×1mentioned ×1subscribed ×1

Root Cause

1. Event Loop Delays (root cause)

Fix Action

Fix / Workaround

Current Workaround

Code Example

liveness warning: reasons=event_loop_delay,cpu interval=32s eventLoopDelayP99Ms=2434.8 eventLoopDelayMaxMs=19562.2 eventLoopUtilization=0.889 cpuCoreRatio=0.972

---

eventLoopDelayMaxMs=9193.9 (2026-04-30 16:25)
eventLoopDelayMaxMs=8413.8 (2026-04-30 16:19)
eventLoopDelayMaxMs=7151.3 (2026-04-30 16:08)
eventLoopDelayMaxMs=8208.3 (2026-04-30 16:13)

---

fetch timeout reached; aborting operation
  url: https://api.telegram.org/bot8655…uTo0/getMe
  timeoutMs: 2500
  elapsedMs: 9919  (9.9 seconds blocked!)

---

totalMs=26106 stages=workspace-sandbox:1ms@1ms,skills:0ms@1ms,core-plugin-tools:13434ms@13435ms,bootstrap-context:9ms@13444ms,bundle-tools:886ms@14330ms,system-prompt:4365ms@18695ms,session-resource-loader:3284ms@21979ms,agent-session:1ms@21980ms,stream-setup:4126ms@26106ms

---

cause: device-required
handshake: failed
durationMs: 3
code: 1008
reason: connect failed

---

ps aux | grep openclaw-tui
kill -9 <pid>

---

openclaw gateway restart
RAW_BUFFERClick to expand / collapse

🐛 TUI freezes on startup — Node.js event loop blocking

Issue Description

The openclaw tui command freezes immediately upon launch, both over SSH and directly on the local machine (Ghostty terminal). The process consumes 100%+ CPU indefinitely, the terminal becomes unresponsive, and the only resolution is to kill the process from outside.

This also affects all gateway operations — the TUI freeze is a symptom of the gateway's Node.js event loop being blocked, which cascades to affect all clients.


Environment

  • OS: Linux 7.0.2-2-cachyos (x64) — CachyOS with Hyprland
  • Kernel: Linux cachyos-ml 7.0.2-2-cachyos
  • Node.js: v25.9.0
  • OpenClaw: 2026.4.29 (just updated from 2026.4.27, issue persists on both versions)
  • Gateway: v2026.4.29, running as systemd service (openclaw-gateway.service)
  • CPU: Intel Xeon E5-2620 v4 @ 2.10GHz (16 cores)
  • RAM: 15Gi total, ~10Gi available
  • Terminal: Ghostty (local), also reproduced over SSH

Symptoms

  1. TUI freeze immediately on launch — UI renders (shows session info) then becomes completely unresponsive within 1-2 seconds
  2. 100%+ CPU usage — The openclaw-tui process enters a tight CPU loop and never recovers
  3. Same issue locally and over SSH — Not specific to SSH or remote terminals
  4. Gateway event loop blocked — Logs show continuous liveness warning entries with severe event loop delays

Evidence from Gateway Logs

File: /tmp/openclaw/openclaw-2026-04-30.log

1. Event Loop Delays (root cause)

The Node.js event loop is being blocked repeatedly, with delays up to 19 seconds:

liveness warning: reasons=event_loop_delay,cpu interval=32s eventLoopDelayP99Ms=2434.8 eventLoopDelayMaxMs=19562.2 eventLoopUtilization=0.889 cpuCoreRatio=0.972

More recent examples:

eventLoopDelayMaxMs=9193.9 (2026-04-30 16:25)
eventLoopDelayMaxMs=8413.8 (2026-04-30 16:19)
eventLoopDelayMaxMs=7151.3 (2026-04-30 16:08)
eventLoopDelayMaxMs=8208.3 (2026-04-30 16:13)

2. Telegram fetch timeouts (contributing factor)

Telegram API calls are timing out, causing the gateway to wait synchronously:

fetch timeout reached; aborting operation
  url: https://api.telegram.org/bot8655…uTo0/getMe
  timeoutMs: 2500
  elapsedMs: 9919  (9.9 seconds blocked!)

These synchronous fetch timeouts are directly blocking the event loop for up to 10+ seconds each.

3. Startup preparation delays (symptom, not cause)

Every embedded agent run takes 24-26 seconds just to prepare, with core-plugin-tools loading taking 12-13 seconds each time:

totalMs=26106 stages=workspace-sandbox:1ms@1ms,skills:0ms@1ms,core-plugin-tools:13434ms@13435ms,bootstrap-context:9ms@13444ms,bundle-tools:886ms@14330ms,system-prompt:4365ms@18695ms,session-resource-loader:3284ms@21979ms,agent-session:1ms@21980ms,stream-setup:4126ms@26106ms

The core-plugin-tools step is loading something from npm each run (32 packages including @mariozechner/pi-ai, @modelcontextprotocol/sdk, etc.) — this should be cached but appears to be reloaded every time.

4. WebSocket probe failures (consequence)

While the TUI is frozen, the gateway sees probe connections fail:

cause: device-required
handshake: failed
durationMs: 3
code: 1008
reason: connect failed

Timeline of Events

  1. 16:19 — User launches openclaw tui
  2. 16:19 — Gateway event loop already under stress (multiple Telegram timeouts have been stacking up)
  3. 16:19-16:33 — TUI frozen, consuming 105% CPU, appears unresponsive
  4. 16:33 — Process killed externally

Key Observations

  1. The Telegram plugin appears to be a major contributor — Every Telegram polling attempt that times out synchronously blocks the event loop for 10+ seconds. With a 2.5s timeout and retry loop, this creates a cascade of blocked operations.

  2. The core-plugin-tools bundle is reloaded every run — 12-13 seconds per run is abnormally slow and suggests no caching of npm dependencies.

  3. The gateway was running fine before today — This suggests either:

    • A regression in 2026.4.29
    • A change in the user's environment (Telegram API issues, network degradation)
    • The accumulated session count (24 sessions) contributing to overhead
  4. The TUI process itself is fine — It's the gateway's blocked event loop that makes the TUI appear frozen. The TUI is waiting for the gateway to respond to WebSocket messages, but the gateway is stuck processing synchronous fetch operations.


Current Workaround

Kill the frozen TUI process:

ps aux | grep openclaw-tui
kill -9 <pid>

Then optionally restart the gateway:

openclaw gateway restart

Questions for Maintainers

  1. Is the core-plugin-tools bundle (32 npm packages) supposed to be cached between runs? 12-13 seconds per run seems excessive.

  2. The Telegram plugin uses synchronous fetchWithTimeout calls that block the event loop. Is this intentional? Should these be moved to worker threads or use async fetch with proper cancellation?

  3. Is there any session cleanup mechanism? With 24 sessions accumulated, could session loading be contributing to the event loop blocking?


System State at Time of Bug

Sessions: 24 active sessions
Plugins: lossless-claw, telegram, minimax, openrouter, google, github-copilot, anthropic, huggingface, memory-core
OpenClaw version: 2026.4.29 (also reproduced on 2026.4.27)
``"

extent analysis

TL;DR

The Node.js event loop is being blocked due to synchronous Telegram API calls and slow loading of the core-plugin-tools bundle, causing the TUI to freeze and consume high CPU.

Guidance

  1. Investigate asynchronous alternatives for the Telegram plugin's fetchWithTimeout calls to prevent event loop blocking.
  2. Implement caching for the core-plugin-tools bundle to reduce loading time from 12-13 seconds to a more reasonable duration.
  3. Review session management to determine if accumulated sessions are contributing to event loop blocking and consider implementing a session cleanup mechanism.

Example

Consider using fetch with async/await and proper cancellation to replace synchronous fetchWithTimeout calls:

async function fetchWithTimeout(url, timeout) {
  const controller = new AbortController();
  const signal = controller.signal;
  const timeoutId = setTimeout(() => controller.abort(), timeout);
  try {
    const response = await fetch(url, { signal });
    return response;
  } catch (error) {
    if (error.name === 'AbortError') {
      throw new Error('Fetch timeout');
    }
    throw error;
  } finally {
    clearTimeout(timeoutId);
  }
}

Notes

The provided solution focuses on addressing the immediate causes of the event loop blocking. Further investigation may be necessary to identify underlying issues, such as network degradation or Telegram API problems.

Recommendation

Apply a workaround by implementing asynchronous Telegram API calls and caching for the core-plugin-tools bundle to alleviate event loop blocking and reduce CPU usage. This approach addresses the immediate symptoms and allows for further investigation into underlying causes.

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 🐛 TUI freezes on startup — Node.js event loop blocking (100%+ CPU) [1 comments, 2 participants]