-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Gateway sync-FS plugin discovery blocks event loop on every channels.status / channel restart #78100
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Symptom
On slow filesystems (WSL2 9P, NFS, container overlays, encrypted volumes) the gateway exhibits long event-loop blocks and inbound dispatch latencies of 17–25s. WhatsApp Web channels also disconnect repeatedly with 408 timeouts, leading to a self-reinforcing reconnect loop.
Repro
pnpm gateway:watchpnpm openclaw message send --channel whatsapp --target +<self> --message "hi"inbound web message→cli execgap of 17–25s in/tmp/openclaw/openclaw-*.logeventLoopDelayMaxMs=6446msin liveness warnings during dispatchWhatsApp Web connection closed (status 408)shortly afterRoot cause
loadPluginRegistrySnapshotWithMetadata(src/plugins/plugin-registry-snapshot.ts) is invoked fromchannels.statuspolls and channel-restart paths. Each invocation re-walks the filesystem synchronously viarealpathSync,statSync,readFileSyncto verify manifest hashes, package.json signatures, and bundled-root paths.23-minute CPU profile (
node --cpu-profon the gateway process):Top JS callers of those syscalls:
Cascading WhatsApp disconnects
Baileys'
keepAliveIntervalMsis 25s. When the event loop blocks for 30s+ duringchannels.whatsapp.start-accountor other discovery-heavy phases, the WS keepalive misses its window and WA returns 408. The disconnect triggers a channel restart, which re-runsstart-account, which re-runs discovery, which blocks again, and so on. Block-to-disconnect correlation in one session:Proposed fixes
loadPluginRegistrySnapshotWithMetadatacalls within a short TTL windowsafeRealpathSync/ boundary-path resolution where path topology is stableThe repo's
src/plugins/CLAUDE.mdcurrently says "Do not add persistent metadata caches for discovery, manifest registries, installed-index reconstruction" — this guidance keeps the design freshness-first, but on slow filesystems the literal cost of "always fresh" is the event loop. Worth an architectural conversation about mtime-gated caching vs. no caching.Workarounds
Affects
All channels and CLI commands on slow filesystems. WhatsApp Web is the most visible symptom because of its keepalive sensitivity.