What happened / 发生了什么
问题描述
AstrBot 运行一段时间后,服务器单核CPU被占满(100%),监控显示用户态占用97%+。
关键诊断信息
- top 命令显示:python 进程 CPU 占用 99%,PID=265298
- strace 诊断:主线程无限循环执行 epoll_wait(6, [], 3, 0) = 0,非阻塞忙等
- ps -T 显示:仅主线程占用CPU,子线程空闲
- 应该异步事件循环死循环 bug
Reproduce / 如何复现?
- 正常启动 AstrBot
- 经过内置chat、飞书聊天等几轮对话,CPU可能会随时跑满
- 可能原因:WAL数据库超过主数据库占用,系统频繁读写
如果 WAL 很大(如 6MB):
- 先读主库 3.8MB
- 再读 WAL 6MB 中的相关变更
- 合并结果返回
- 每次查询都要扫描大量 WAL → CPU 飙高
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
1panel docker部署
- 系统:Linux(ubuntu24、debian12)
- AstrBot 版本:4.24.2
- Python 版本:3
OS
Linux
Logs / 报错日志
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct
What happened / 发生了什么
问题描述
AstrBot 运行一段时间后,服务器单核CPU被占满(100%),监控显示用户态占用97%+。
关键诊断信息
Reproduce / 如何复现?
如果 WAL 很大(如 6MB):
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
1panel docker部署
OS
Linux
Logs / 报错日志
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct