WPS灵犀Claw Sandbox 环境卡死 Bug 反馈

灵犀claw环境卡死bug反馈.md

WPS灵犀Claw Sandbox 环境卡死 Bug 反馈

反馈日期:2026-06-01
反馈人:东方(国家注册高级审核员,25年ISO体系咨询经验)
影响版本:v2.12.0(sandbox build 4db158ed-20260520)、v2.13.2(sandbox build eeda6030-20260525)
当前安装版本:Claw v1.1.23,sandbox v2.13.2

1. 问题描述

灵犀Claw新版(2026年5月中下旬起)频繁出现代码执行环境卡死现象。表现为:

  • 新会话启动后首个代码执行请求长时间无响应(10s~60s+)

  • 最终要么超时报错,要么执行器进程被强杀重启

  • 严重影响工作效率,几乎每次新会话都会遇到

2. 日志证据链

2.1 每日超时统计

C:\Users\Administrator\AppData\Roaming\WPS 灵犀\logs\sandbox_*.log 统计:

日期

日志大小

600s超时次数

备注

5/17

5.2MB

0

旧版本,正常

5/18

2.7MB

0

旧版本,正常

5/19

1.9MB

23

超时开始激增

5/20

2.9MB

83

最严重的一天

5/21

5.1MB

52

仍然严重

5/22

0.8MB

3

轻微改善

5/23

(gzip)

-

压缩日志未解压

5/24

1.6MB

8

有所改善

5/25

1.6MB

12

仍不稳定

5/26

1.9MB

15

仍不稳定

5/27

1.6MB

10

仍不稳定

5/28

2.8MB

18

波动

5/29

4.3MB

22

加重

5/30

3.4MB

20

加重

5/31

1.0MB

8

略有改善

6/1

2.6MB

38

v2.13.2新版

2.2 典型卡死链条(v2.13.2,2026-06-01 18:35会话)

[18:35:45.000] Python执行器进程启动(pid=14320),setup耗时52ms
[18:35:45.000] 发送 ready 信号(deferred_init=True)
[18:35:45.000] deferred-init 线程启动
[18:35:45.000] hook codesign 完成 (0ms)
[18:35:45.000] hook plotly 完成 (141ms)
              --- matplotlib hook 开始,扫描 C:\Windows\Fonts 290个字体 ---
              --- 此时被 _hooks_ready 门控,exec请求排队等待 ---
[18:36:10.000] exec 请求到达(间隔25s=LLM推理时间)
              --- exec请求被阻塞,等待 _hooks_ready ---
[18:36:10.000] 已注册 290 个系统字体到 matplotlib
[18:36:11.000] matplotlib hook 完成 (25750ms) ← 瓶颈!
[18:36:11.000] 已安装 281 个包 (26266ms) ← 包含matplotlib hook时间
[18:36:11.000] 全部 hook 初始化完成 (26266ms)
[18:36:11.000] _hooks_ready.set() → exec请求解除阻塞
[18:36:12.000] exec 完成 (2436ms)

总阻塞时间:25.7秒(matplotlib hook)+ 少量开销。

2.3 matplotlib hook 耗时对比(v2.13.2,2026-06-01当天)

时间

codesign

plotly

matplotlib

总耗时

状态

18:10

-

-

781ms

1219ms

正常

18:26

0ms

156ms

1234ms

1672ms

正常

18:35

0ms

141ms

25750ms

26266ms

卡死

20:31

0ms

156ms

4297ms

5485ms

偏慢

matplotlib hook 耗时波动范围:781ms ~ 25750ms,差异达32倍。

3. 根本原因分析

3.1 v2.12.0(旧版)的瓶颈

lingxi-sandbox.exe(Go二进制)中提取的Python bootstrap代码发现:

def_deferred_init_all() -> None:
    """后台串行初始化所有 hook"""
    t0 = time.monotonic()
    _hooks = [
        ("plotly", _install_plotly_hook),
        ("matplotlib", _install_matplotlib_hook),
        ("reportlab", _install_reportlab_hook),
        ("openpyxl", _install_openpyxl_hook),
    ]
    for name, fn in _hooks:  # 串行执行
        ...

同时Go侧在Python启动前执行 pip install 281个包(从requirements.txt)。

v2.12.0卡死链条:Go侧pip install 281包(平均26秒)→ Python deferred-init matplotlib hook(平均25秒)→ 串行总耗时超过60秒心跳超时 → 进程被强杀。

3.2 v2.13.2(新版)的改进与残余问题

已修复

  • Go侧不再一次性pip install 281包(改为按需安装,1-2秒/包)

  • reportlab和openpyxl改为lazy import hook(不再在deferred-init中阻塞)

  • 启动日志明确标注"环境初始化已跳过(由客户端控制)"

残余问题

matplotlib hook中的fontManager.addfont()逐个注册290个系统字体,间歇性耗时从781ms到25750ms不等。

3.3 间歇性慢的根因:Windows Defender实时扫描

发现python-env目录包含 29,429个.pyc文件(473MB),但Windows Defender排除列表中未包含python-env目录和lingxi-sandbox.exe进程

当matplotlib hook扫描字体时,matplotlib内部会:

  1. 加载fontManager缓存(若不存在则全量扫描系统字体)

  1. 每个字体文件都可能触发Windows Defender IO过滤驱动

  1. 同时大量.pyc文件的import也会触发实时扫描

  1. Defender扫描队列积压导致IO延迟指数级增长

浏览 44
收藏
3
分享
3 +1
+1
全部评论