openclaw - 💡(How to fix) Fix node.list RPC blocks event loop 30-48s when orphaned agent directories exist [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#76096Fetched 2026-05-03 04:42:28
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Author
Timeline (top)
commented ×1cross-referenced ×1unsubscribed ×1

The node.list RPC call performs a filesystem scan over all directories in ~/.openclaw/agents/ on every invocation, including directories that are orphaned (not present in agents.list). On hosts with many stale agent directories and slow storage (eMMC/SD card), this causes the Node.js event loop to block for 30–48 seconds per call, making the gateway unresponsive.

Error Message

[WARN] liveness warning: reasons=event_loop_delay interval=57s eventLoopDelayP99Ms=34.2 eventLoopDelayMaxMs=36473.7 eventLoopUtilization=0.667 cpuCoreRatio=0.659

Root Cause

The node.list RPC call performs a filesystem scan over all directories in ~/.openclaw/agents/ on every invocation, including directories that are orphaned (not present in agents.list). On hosts with many stale agent directories and slow storage (eMMC/SD card), this causes the Node.js event loop to block for 30–48 seconds per call, making the gateway unresponsive.

Fix Action

Workaround

Manually delete orphaned directories:

# Keep only dirs that match an entry in agents.list
cd ~/.openclaw/agents
# Remove all dirs not in your agents.list

Code Example

[WARN] liveness warning: reasons=event_loop_delay interval=57s eventLoopDelayP99Ms=34.2 eventLoopDelayMaxMs=36473.7 eventLoopUtilization=0.667 cpuCoreRatio=0.659
[INFO] ⇄ res ✓ node.list 48689ms
[INFO] ⇄ res ✓ sessions.list 7001ms

---

# Keep only dirs that match an entry in agents.list
cd ~/.openclaw/agents
# Remove all dirs not in your agents.list
RAW_BUFFERClick to expand / collapse

Summary

The node.list RPC call performs a filesystem scan over all directories in ~/.openclaw/agents/ on every invocation, including directories that are orphaned (not present in agents.list). On hosts with many stale agent directories and slow storage (eMMC/SD card), this causes the Node.js event loop to block for 30–48 seconds per call, making the gateway unresponsive.

Environment

  • OpenClaw version: 2026.4.29 (a448042)
  • OS: Ubuntu, Linux 6.8.0-111-generic x86_64
  • Hardware: Intel Celeron N4000 @ 1.10GHz, 2 cores, eMMC storage
  • Node.js: 25.5.0

Steps to Reproduce

  1. Add many agents to agents.list, use them, then remove them from the config (leaving their directories on disk)
  2. Or install a bulk agent pack and later remove entries from config
  3. Start the gateway
  4. Open the control UI — trigger node.list RPC call
  5. Observe event loop delay

Observed Behavior

  • node.list takes 48 seconds to respond
  • sessions.list takes 7–8 seconds
  • Gateway liveness warning fires: eventLoopDelayMaxMs=36473.7ms, eventLoopUtilization=0.667
  • Gateway process consumes 85–100% CPU on a 2-core machine
  • System load average reaches 3.5+ on a 2-core host

Log evidence:

[WARN] liveness warning: reasons=event_loop_delay interval=57s eventLoopDelayP99Ms=34.2 eventLoopDelayMaxMs=36473.7 eventLoopUtilization=0.667 cpuCoreRatio=0.659
[INFO] ⇄ res ✓ node.list 48689ms
[INFO] ⇄ res ✓ sessions.list 7001ms

152 agent directories were present on disk; only 2 were registered in agents.list. After manually deleting the 150 orphaned directories, node.list response time dropped dramatically and gateway CPU settled to ~25%.

Expected Behavior

  • node.list should only scan directories for agents present in agents.list, skipping orphaned directories entirely
  • Alternatively, disk I/O should be non-blocking / async so it does not stall the event loop regardless of directory count

Secondary Issue: No cleanup path

openclaw doctor detects orphaned agent directories and warns about them, but offers no fix command — only a manual instruction to "restore or remove stale dirs." Given that orphaned dirs directly cause severe performance degradation, doctor --fix should handle this automatically.

Workaround

Manually delete orphaned directories:

# Keep only dirs that match an entry in agents.list
cd ~/.openclaw/agents
# Remove all dirs not in your agents.list

extent analysis

TL;DR

Manually deleting orphaned agent directories or implementing an asynchronous filesystem scan can significantly improve the performance of the node.list RPC call.

Guidance

  • Identify and remove orphaned agent directories that are not present in agents.list to reduce the number of directories scanned by node.list.
  • Consider modifying the node.list implementation to use non-blocking or asynchronous disk I/O to prevent event loop delays.
  • Use the openclaw doctor command to detect orphaned directories, but note that it currently requires manual removal.
  • To automate the removal of orphaned directories, consider adding a --fix option to the openclaw doctor command.

Example

# Remove orphaned directories
cd ~/.openclaw/agents
for dir in */; do
  if ! grep -q "${dir%/}" ~/path/to/agents.list; then
    rm -rf "$dir"
  fi
done

Notes

The provided workaround requires manual intervention and may not be suitable for all environments. A more permanent solution would involve modifying the node.list implementation or adding automated cleanup functionality to openclaw doctor.

Recommendation

Apply the workaround by manually deleting orphaned directories, as this is a straightforward and effective solution to improve performance. Consider submitting a feature request to add automated cleanup functionality to openclaw doctor for a more permanent solution.

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 node.list RPC blocks event loop 30-48s when orphaned agent directories exist [1 comments, 2 participants]