Skip to content

node.list RPC blocks event loop 30-48s when orphaned agent directories exist #76096

@DBOYttt

Description

@DBOYttt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions