openclaw - 💡(How to fix) Fix [Bug]: pdf-tool initialization blocks event loop for ~10s on every run [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

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#77204Fetched 2026-05-05 05:51:09
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
2
Timeline (top)
labeled ×2mentioned ×2subscribed ×2closed ×1

The pdf-tool core embedded tool takes ~10 seconds to initialize on every agent run, blocking the Node.js event loop completely. This causes session timeouts, queue stalls (65s+), and liveness warnings. Observed 35+ times consecutively.

Root Cause

The pdf-tool core embedded tool takes ~10 seconds to initialize on every agent run, blocking the Node.js event loop completely. This causes session timeouts, queue stalls (65s+), and liveness warnings. Observed 35+ times consecutively.

Fix Action

Fix / Workaround

pdf-tool 是 core embedded tool,不是 plugin,无法通过 plugins.entries 禁用 workaround:在 config 中设置 tools.deny: ["pdf"] 完全排除 建议修复:lazy loading / 初始化后 cache / 异步加载不阻塞主线程

Code Example

# Trace (repeated 35+ times, all ~10s):
openclaw-tools:pdf-tool:10198ms@12216ms
openclaw-tools:pdf-tool:10584ms@12672ms
openclaw-tools:pdf-tool:9920ms@11304ms

# Liveness warning:
eventLoopDelayMaxMs=11853.1, eventLoopUtilization=1, cpuCoreRatio=0.763

# Queue stall:
lane=session:agent:main:main waitedMs=65777

# Session timeout:
failover decision: surface_error reason=timeout from=xiaomi-coding/mimo-v2.5-pro
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

The pdf-tool core embedded tool takes ~10 seconds to initialize on every agent run, blocking the Node.js event loop completely. This causes session timeouts, queue stalls (65s+), and liveness warnings. Observed 35+ times consecutively.

Steps to reproduce

复现步骤:

Start OpenClaw 2026.5.2 on Windows 11 (npm global install) Send any message to trigger an agent run Check gateway logs for [trace:embedded-run] core-plugin-tool stages Observe openclaw-tools:pdf-tool consistently takes 9500–11500ms During this window, event loop utilization = 100%, all WS requests blocked

Expected behavior

Tool initialization should either (a) be lazy — only load when pdf tool is actually called, (b) cache after first load so subsequent runs don't re-initialize, or (c) run off the main thread.

Actual behavior

Every agent run re-initializes pdf-tool synchronously on the main thread (~10s). This blocks all other operations, causing:

liveness warning: eventLoopDelayMaxMs=11853.1, eventLoopUtilization=1 lane wait exceeded: waitedMs=65777 failover decision: surface_error reason=timeout from=xiaomi-coding/mimo-v2.5-pro

OpenClaw version

2026.5.2

Operating system

Windows 11 (10.0.22631 x64)

Install method

NPM Global

Model

xiaomi-coding/mimo-v2.5-pro

Provider / routing chain

OpenClaw -> token-plan-cn.xiaomimimo.com

Additional provider/model setup details

No response

Logs, screenshots, and evidence

# Trace (repeated 35+ times, all ~10s):
openclaw-tools:pdf-tool:10198ms@12216ms
openclaw-tools:pdf-tool:10584ms@12672ms
openclaw-tools:pdf-tool:9920ms@11304ms

# Liveness warning:
eventLoopDelayMaxMs=11853.1, eventLoopUtilization=1, cpuCoreRatio=0.763

# Queue stall:
lane=session:agent:main:main waitedMs=65777

# Session timeout:
failover decision: surface_error reason=timeout from=xiaomi-coding/mimo-v2.5-pro

Impact and severity

受影响:所有 agent 实例的每次对话 严重程度:高(每次对话 +10s 启动延迟,并发会话互相阻塞) 频率:100%(35+ 次连续观察) 后果:会话超时、队列 65s 等待、模型请求被误判超时

Additional information

pdf-tool 是 core embedded tool,不是 plugin,无法通过 plugins.entries 禁用 workaround:在 config 中设置 tools.deny: ["pdf"] 完全排除 建议修复:lazy loading / 初始化后 cache / 异步加载不阻塞主线程

extent analysis

TL;DR

The pdf-tool initialization can be optimized by implementing lazy loading, caching, or asynchronous loading to prevent blocking the Node.js event loop.

Guidance

  • Investigate the feasibility of lazy loading the pdf-tool, only loading it when actually needed, to reduce the initialization time.
  • Consider caching the pdf-tool after the first load, so subsequent runs don't require re-initialization, to minimize the performance impact.
  • Explore the possibility of running the pdf-tool initialization off the main thread to prevent blocking the event loop.
  • Review the tools.deny configuration option to temporarily workaround the issue by excluding the pdf-tool.

Example

No code snippet is provided as the issue does not contain sufficient information about the implementation details of the pdf-tool.

Notes

The provided workaround, setting tools.deny: ["pdf"] in the config, may not be a permanent solution but can help mitigate the issue temporarily.

Recommendation

Apply the workaround by setting tools.deny: ["pdf"] in the config, as it provides a temporary solution to exclude the pdf-tool and prevent the initialization delay.

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…

FAQ

Expected behavior

Tool initialization should either (a) be lazy — only load when pdf tool is actually called, (b) cache after first load so subsequent runs don't re-initialize, or (c) run off the main thread.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING