agentscope-ai / agentscope-ai/AgentTeams

work 容器假死,manager无法唤醒。 || work The container is suspended and the manager cannot wake up.

未關閉
#949 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:worker-runtime bug
主要語言
Go
星號
5.6k
分支
692
平均合併
5 天 4 小時
30 天內合併 PR
23

描述

### Bug Description

hiclaw Worker 假死根因分析报告
时间线概览
时间 (UTC) 事件 说明
01:11:05 Worker 启动 拉取配置、同步文件
01:13:20 Agent 启动 data-engineer agent 上线
01:18:19 首次 Heartbeat 正常完成 (3.7s)
01:18:24 ~ 03:00:44 假死期 #1 ~1小时42分钟无任务处理
03:00:44 dreaming-narrative 触发 cron 任务恢复
03:01:06 dreaming 完成
03:01:06 ~ 06:47:35 假死期 #2 ~3小时46分钟无任务处理
06:47:36 Matrix 消息触发 外部消息唤醒 worker
06:47:36 ~ 07:03:48 超长 run 单次 run 耗时 972秒 (16.2分钟)
07:04:04 最后一次 run 完成 之后日志只剩 HEARTBEAT.md 同步
根因: HEARTBEAT.md 文件同步风暴 (Sync Storm)
核心问题在于 Local->Remote change-triggered sync (PID 106) 陷入了一个病态循环:
HEARTBEAT.md 无限同步循环: 在假死期间,日志中 唯一的活动 就是不断地同步 HEARTBEAT.md(193字节),每~10秒一个循环:
/root/hiclaw-fs/agents/data-engineer/HEARTBEAT.md -> hiclaw/hiclaw/agents/data-engineer/HEARTBEAT.md
┌───────┬─────────────┬──────────┬─────────────┐
│ 193 B │ 193 B │ 00m00s │ xx KiB/s │
└───────┴─────────────┴──────────┴─────────────┘
┌───────┬─────────────┬──────────┬───────┐
│ 0 B │ 0 B │ 00m00s │ 0 B/s │ <-- 紧接着一个空同步
└───────┴─────────────┴──────────┴───────┘
文件变更触发机制死循环: HEARTBEAT.md 每次被 heartbeat 进程读取/更新 → 触发 inotify 文件变更事件 → sync 进程上传到 MinIO → 同步操作本身可能更新了文件时间戳 → 再次触发变更事件 → 循环往复。
sync 进程占满主循环: 这个 change-triggered sync (PID 106) 与 worker agent 的 event loop 共享同一进程。在 01:18 ~ 03:00 和 03:01 ~ 06:47 两个假死期间,约 24,000 行日志几乎全是 HEARTBEAT.md 的重复同步(占日志总量 54,630 行的 ~88%)。
加剧因素
因素 详情
heartbeat 只触发不执行 heartbeat 在 01:18:24 后就不再发起新的 embedded run,直到 03:00 的 cron 触发了 dreaming。说明 heartbeat 的定时器被 sync 风暴阻塞
WS tick 仍在运行 [ws] → event tick 每 30 秒一次持续正常(seq 从 13 增长到 1295),说明 网络层未断,worker 并非网络假死,而是 应用层被 sync 阻塞
health event 正常上报 healthVersion 从 108 增长到 335,说明 health monitor 独立于主循环运行
credentials.json 频繁同步 每 ~60 秒同步一次 credentials.json(298~326B),是另一个持续的文件变更源
Matrix 通道完全静默 03:01 ~ 06:47 之间没有任何 Matrix 消息到达,说明 worker 的消息处理被阻塞,无法响应 Matrix 事件
第 06:47 那次超长 run (972秒) 的分析
这次 run 本身不是假死,而是 worker 终于收到 Matrix 消息后的正常响应。它耗时长的原因:
执行了 30+ 次 tool call(read, exec, process, write, web_fetch)
多个 process tool 各耗时 ~2 分钟(如 06:57:24 → 06:59:24, 06:59:29 → 07:01:29)
session 上下文巨大:messages=108, historyTextChars=62293

### Steps to Reproduce

1.manager创建work容器并分配任务
2.work容器执行任务后,生成产出并@manager,但实际上这个时候已经假死,manager未收到任何消息
3.manager无法唤醒work容器

### AI Analysis

[work.log](https://github.com/user-attachments/files/29158480/work.log)

### Relevant Logs

```shell
https://github.com/user-attachments/files/29158480/work.log
```

### Component

Manager Agent

### Version / Commit

_No response_

---
### Bug Description

hiclaw Worker suspended animation root cause analysis report
Timeline overview
Time (UTC) Event Description
01:11:05 Worker starts pulling configuration and synchronizing files
01:13:20 Agent starts data-engineer agent and goes online
01:18:19 The first Heartbeat completed normally (3.7s)
01:18:24 ~ 03:00:44 Suspended Death Period #1 ~1 hour and 42 minutes without task processing
03:00:44 dreaming-narrative triggers cron task recovery
03:01:06 dreaming completed
03:01:06 ~ 06:47:35 Suspended Death Period #2 ~3 hours and 46 minutes without task processing
06:47:36 Matrix message triggers external message to wake up worker
06:47:36 ~ 07:03:48 Super long run. A single run takes 972 seconds (16.2 minutes)
07:04:04 After the last run is completed, only HEARTBEAT.md synchronization remains in the log.
Root cause: HEARTBEAT.md file synchronization storm (Sync Storm)
The core problem is that Local->Remote change-triggered sync (PID 106) is stuck in a pathological loop:
HEARTBEAT.md infinite synchronization loop: During the suspended animation period, the only activity in the log is the continuous synchronization of HEARTBEAT.md (193 bytes), a loop every ~10 seconds:
/root/hiclaw-fs/agents/data-engineer/HEARTBEAT.md -> hiclaw/hiclaw/agents/data-engineer/HEARTBEAT.md
┌───────┬────────────┬──────────┬───────────────┐
│ 193 B │ 193 B │ 00m00s │ xx KiB/s │
└───────┴────────────┴──────────┴───────────────┘
┌───────┬────────────┬──────────┬────────┐
│ 0 B │ 0 B │ 00m00s │ 0 B/s │ <-- followed by a null sync
└───────┴────────────┴──────────┴────────┘
The file change trigger mechanism has an infinite loop: HEARTBEAT.md is read/updated every time by the heartbeat process → the inotify file change event is triggered → the sync process is uploaded to MinIO → the synchronization operation itself may update the file timestamp → the change event is triggered again → the cycle continues.
The sync process fills the main loop: This change-triggered sync (PID 106) shares the same process as the worker agent's event loop. During the two suspended animation periods of 01:18 ~ 03:00 and 03:01 ~ 06:47, approximately 24,000 lines of logs were almost all repeated synchronizations of HEARTBEAT.md (accounting for ~88% of the total 54,630 lines of logs).
aggravating factors
Factor Details
Heartbeat only triggers but does not execute. Heartbeat will no longer initiate new embedded runs after 01:18:24 until cron triggers dreaming at 03:00. Description The heartbeat timer is blocked by sync storm
WS tick is still running [ws] → event tick occurs once every 30 seconds and continues normally (seq increases from 13 to 1295), indicating that the network layer is not interrupted, and the worker is not suspended in the network, but the application layer is blocked by sync
The health event is reported normally and the healthVersion increases from 108 to 335, indicating that the health monitor runs independently of the main loop.
Credentials.json Frequent Synchronization Credentials.json (298~326B) is synchronized every ~60 seconds, which is another continuous source of file changes.
The Matrix channel is completely silent. No Matrix messages arrive between 03:01 ~ 06:47, indicating that the worker's message processing is blocked and cannot respond to Matrix events.
Analysis of the very long run (972 seconds) at 06:47
This run itself is not a suspended animation, but a normal response after the worker finally receives the Matrix message. Reasons why it takes so long:
Executed 30+ tool calls (read, exec, process, write, web_fetch)
Multiple process tools each take ~2 minutes (such as 06:57:24 → 06:59:24, 06:59:29 → 07:01:29)
The session context is huge: messages=108, historyTextChars=62293

### Steps to Reproduce

1.Manager creates a work container and assigns tasks
2. After the work container executes the task, it generates output and @manager, but in fact it has suspended animation at this time and the manager has not received any message.
3.Manager cannot wake up the work container

### AI Analysis

[work.log](https://github.com/user-attachments/files/29158480/work.log)

### Relevant Logs

```shell
https://github.com/user-attachments/files/29158480/work.log
```

### Component

Manager Agent

### Version/Commit

_No response_

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。