[moz] infra: CI run #480 卡在 queued,runner 未拾取任务 #121
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题描述
CI run #480(PR #120)所有 job 卡在 queued/in_progress 状态,runner 未拾取执行。
错误来源
d2e449bca8现象
lint job 的所有 step 都是
queued状态,说明没有任何 runner 拾取。test/frontend/notify 依赖 lint 完成所以一直 waiting。判断依据
queued(非running),说明问题不在 CI 脚本本身,而是 runner 没有注册或已掉线期望
docker ps/act_runner daemon日志)排查与修复完成
根因
act_runner 进程(PID 33451)虽然存活且心跳正常(Gitea DB
last_online= 实时),但其任务分发循环卡死。runner 在 19:53 CST 处理完最后一个 task 后,未能拾取 20:29 CST 新建的 CI #480 任务。证据链:
action_runner表:last_online= 实时更新(心跳正常),last_active= 1782129222(47 分钟前)action_task表:task 1174(CI #480 lint job)status=6(running),started=1782131351(20:29:11 CST),stopped=0(从未完成)修复操作
pm2 restart sanguo-act-runner(新 PID 22204)c2e710b到 PR #120 分支,触发 CI #481Runner 重启后的 task 拾取
重启后 runner 立即重新注册(labels: [macos-arm64])并开始正常拾取任务。CI #481 从触发到全部完成约 2 分钟。
后续建议
last_active超过 30 分钟且无 task 运行,自动告警@jiangwei-infra 调查卡死的根因
深入根因调查
数据概览
通过 Gitea DB 直接查询
action_task+action_task_step表,发现 CI 卡死是系统性 recurring 问题,非偶发:根因分析
卡死发生在两个层面:
层面 1:act_runner 任务执行死锁
现象:
last_online实时更新)runner_id=3,task status=6(running)action_task_step的所有 step:log_length=0(零日志),started=stopped=最终超时时间根因推断:act_runner v1.0.8 的任务执行 pipeline 在 setup 阶段死锁。可能原因:
~/.cache/act/下有两个缓存的 action repo(actions/checkout和actions/setup-node)。如果前一个 task 的 cleanup 未完成,下一个 task 的 checkout action 初始化会 hanggit config)hang,整个 pipeline 阻塞层面 2:Gitea 服务端超时标记
现象:
status=2(failure)started=stopped=超时时间戳,log_length=0层面 3(庞统发现的):Gitea 状态汇总 bug
CI #480 lint job 在 Gitea Web/API 中显示为:
stopped_at为空这是 Gitea 的另一个问题:当 runner 重启时 cancel 了 in-progress job,Gitea 创建了新的 task attempt(#1175),API 返回的是新 attempt 的 step 状态(success),但 job 级别仍保留原始 attempt(#1174)的 failure 状态。显示不一致是 Gitea 1.26.2 的 bug,非 runner 问题。
共同条件
所有 6 次卡死都满足:
needs=null)这意味着卡死是概率性的——每次 Gitea dispatch 第一个 job 到 runner 时,有 ~0.8% 概率 runner 接受 task 但执行 pipeline 死锁。
短期方案(已实施)
中期建议
if: failure()在 Gitea 中不支持,但可以加一个 retry job)~/.cache/act/下的 action repo 缓存,强制重新 clone长期建议
这样,你能否改成文档改动不走ci cd,只有代码改动才走ci cd呢 @jiangwei-infra
@admin 已实现:文档改动跳过 CI/CD
方案
在 ci.yml 和 deploy.yml 的触发条件中加
paths-ignore,纯文档路径的改动不触发 CI/CD:效果
docs/、mockups/、prompt_templates/、*.md→ 不触发 CI(不跑 lint/test/frontend)docs/→ merge 后 不触发 Deploysrc/、tests/、config/、scripts/等代码路径 → 正常触发 CI/CDPR
PR #122:#122
请 review 后 merge。