Bug Description
The Discord plugin's HTTP fetch calls to https://discord.com/api/v10/users/@me are causing the Node.js event loop to block for extended periods (3+ seconds), resulting in severe liveness warning alerts.
Environment
- OpenClaw version: 2026.5.3-1
- Node.js version: 24.15.0
- Platform: Windows_NT 10.0.26100 (x64)
- Host: GGX-THINKPAD
Steps to Reproduce
- Enable Discord channel plugin (channels.discord.enabled: true)
- Gateway starts and connects to Discord API
- Observe liveness warnings in logs immediately
Observed Behavior
Log excerpt:
[fetch-timeout] fetch timeout after 2500ms (elapsed 3013ms) operation=fetchWithTimeout url=https://discord.com/api/v10/users/@Me [diagnostic] liveness warning: reasons=event_loop_delay interval=30s eventLoopDelayP99Ms=35.3 eventLoopDelayMaxMs=1362.1 eventLoopUtilization=0.096 cpuCoreRatio=0.093
Key observations:
- Direct Node.js fetch test is FAST: etch('https://discord.com/api/v10/users/@me', {headers:{Authorization:'Bot ...'}}) returns in ~600ms — completely normal
- Direct curl test is FAST: ~232ms
- The etchWithTimeout wrapper in the Discord plugin causes blocking: The AbortController timeout mechanism itself appears to block the event loop for the full timeout duration (2500ms + overhead = 3013ms)
- Timer is delayed: The timeout fired at 3013ms instead of 2500ms, indicating the timer was itself blocked by ~513ms
- Low CPU utilization during block: Only 23% CPU — this is I/O wait, not computation
Root Cause Hypothesis
The etchWithTimeout from openclaw/plugin-sdk/text-runtime uses setTimeout wrapped around an AbortController-based fetch. When the fetch is in flight, something in the Node.js 24.x fetch/undici implementation or the plugin-sdk's getResolvedFetch appears to block the event loop synchronously during DNS/TLS/hot connection reuse, causing the timeout timer itself to be delayed.
The Discord plugin probe at dist/probe-DmHUl6wI.js calls:
js const res = await fetchWithTimeout(${DISCORD_API_BASE}/users/@me, { headers: { Authorization: Bot } }, timeoutMs, getResolvedFetch(fetcher));
Impact
- Gateway event loop blocks for 3+ seconds during Discord API probe
- Causes severe liveness warning with eventLoopDelayMaxMs up to 5440ms
- Affects overall gateway responsiveness
Suggested Fix Directions
- Investigate whether getResolvedFetch(fetcher) returns a different fetch implementation that behaves synchronously under Node.js 24.x
- Consider using a non-blocking timeout approach (e.g., separate worker thread for Discord API calls)
- Increase the timeout from 2500ms to something more generous, or make it configurable
- Add retry logic with exponential backoff instead of blocking the main thread
Tags
bug, discord, event-loop, node.js-24, performance
Bug Description
The Discord plugin's HTTP fetch calls to https://discord.com/api/v10/users/@me are causing the Node.js event loop to block for extended periods (3+ seconds), resulting in severe liveness warning alerts.
Environment
Steps to Reproduce
Observed Behavior
Log excerpt:
[fetch-timeout] fetch timeout after 2500ms (elapsed 3013ms) operation=fetchWithTimeout url=https://discord.com/api/v10/users/@Me [diagnostic] liveness warning: reasons=event_loop_delay interval=30s eventLoopDelayP99Ms=35.3 eventLoopDelayMaxMs=1362.1 eventLoopUtilization=0.096 cpuCoreRatio=0.093Key observations:
Root Cause Hypothesis
The etchWithTimeout from openclaw/plugin-sdk/text-runtime uses setTimeout wrapped around an AbortController-based fetch. When the fetch is in flight, something in the Node.js 24.x fetch/undici implementation or the plugin-sdk's getResolvedFetch appears to block the event loop synchronously during DNS/TLS/hot connection reuse, causing the timeout timer itself to be delayed.
The Discord plugin probe at dist/probe-DmHUl6wI.js calls:
js const res = await fetchWithTimeout(${DISCORD_API_BASE}/users/@me, { headers: { Authorization: Bot } }, timeoutMs, getResolvedFetch(fetcher));Impact
Suggested Fix Directions
Tags
bug, discord, event-loop, node.js-24, performance