Skip to content

[Bug]: ONNX Runtime 下载的 120 秒上限导致广州 DinD 冷构建稳定失败 #26664

Closed

Description

@Ariznawlll

Description

BUILD MO DOCKER IMAGE 在广州 DinD runner 冷构建时稳定失败。thirdparties/download 对 21.9 MiB ONNX Runtime 文件设置了单次 120 秒传输上限;当前 runner 到 GitHub raw 的实际速度不足以在该时间内完成。每次重试都会丢弃已下载部分并从零开始,最终 make -C thirdparties 以 curl 28 退出,整条 nightly 被阻断。

Environment

  • Branch: main
  • Commit: c58cd292d3e6e039a8882654d3b20ad345171e87
  • Deployment: GitHub Actions self-hosted Guangzhou DinD runner,docker build -f optools/images/Dockerfile
  • Affected dependency: ONNX Runtime 1.26.0, linux_x64, 23,023,576 bytes

Steps to reproduce

  1. 在广州 DinD runner 上使用未命中目标镜像和 native layer 缓存的新 MatrixOne commit。

  2. 执行 nightly 中的构建命令:

    docker build -t <image>:commit-<sha> \
      -f optools/images/Dockerfile . \
      --build-arg GOPROXY="http://goproxy.goproxy.svc.cluster.local"
  3. Dockerfile native stage 执行:

    make -C thirdparties
  4. 观察 thirdparties/download 下载固定 SHA-256 的 ONNX Runtime 文件。

Actual behavior

失败运行 30835724962 中,4 次传输均在约 120 秒后退出;每次只完成约 4.7-5.7 MiB:

curl: (28) Operation timed out after 119708 milliseconds
curl: (28) SSL connection timeout
dependency download failed with curl exit code 28
make: *** [Makefile:192: onnxruntime] Error 1

运行 30757360790 中也出现相同结果,4 次传输仅完成约 1.6-2.0 MiB 后分别被丢弃。两个使用当前下载器的冷构建共 8/8 次传输失败。

Expected behavior

在连接持续有下载进度且最终文件满足大小上限及 SHA-256 校验时,慢速外网不应仅因固定 120 秒总时长而使构建失败。重试应保留安全可验证的部分下载,或构建应从广州可稳定访问的内部制品源/持久缓存获取该固定依赖。

Stability and controls

  • Reproducer: 当前下载器在两个连续 nightly 冷构建中共 8/8 次默认传输失败。
  • Control: 2026-08-01 的构建对同一 21.9 MiB 文件持续下载约 14 分 35 秒后成功,SHA-256 校验通过;证明文件和固定源可用,但 120 秒上限与实际链路速度不兼容。
  • Failure atomicity/data check: 下载器没有发布校验失败的目标文件,失败关闭行为正确;问题是可完成的慢速下载被提前终止,导致镜像未构建。

Evidence

Code analysis

  • thirdparties/download 默认 MO_DOWNLOAD_MAX_TIME_SECONDS=120,curl 使用 --max-time 120。
  • 23,023,576 字节需要平均约 187 KiB/s 才能在 120 秒内完成;失败 runner 实测约 14-47 KiB/s。
  • curl 重试没有启用断点续传,日志明确显示每轮 Throwing away ... bytes,四次机会无法累计进度。
  • Dockerfile 将依赖放入独立 native stage,但 nightly 使用普通 docker build,未配置跨临时 DinD runner 的 --cache-from/--cache-to,新 tag 冷构建仍需直接访问 GitHub。
  • 最新 main 的 thirdparties/download blob 与失败提交一致,问题仍存在。

Regression coverage

修复应增加 shell 回归测试:模拟一个持续产生下载进度但单次窗口不足以完成的传输,验证重试可续传并在最终 SHA-256 校验后原子发布;同时覆盖无进度超时、校验失败、超过大小限制和已验证缓存复用。

Related

Activity

  1. added this to the MO-202608 milestone on Aug 4, 2026
  2. added
    kind/bug
    on Aug 4, 2026
  3. added theissue type on Aug 4, 2026
  4. self-assigned this
    on Aug 4, 2026
  5. Ariznawlll commented on Aug 4, 2026

    @Ariznawlll
    CollaboratorAuthor

    根因补充与建议的长期方案

    最新分支验证 mo-nightly-regression run 30883927322 表明,这个问题不只是固定 120 秒总超时:

    • 广州 runner 构建 native stage 时执行 make -C thirdparties。
    • ONNX Runtime 下载连续 4 次都在约 15 秒的连接/SSL 建连阶段超时,传输字节数为 0。
    • 因此,仅把 MO_DOWNLOAD_MAX_TIME_SECONDS 从 120 秒调大,或者增加断点续传,无法解决“连接都建立不起来”的场景。
    • #26671 可以保留为通用网络容错,但不应承担 nightly 加速和稳定性的主要职责。

    当前缓存现状

    MatrixOne main 的 native-dependency-check.yml 当前使用的是 GitHub Actions Cache:

    cache-from: type=gha,scope=matrixone-native-${{ matrix.arch }}
    cache-to: type=gha,mode=max,scope=matrixone-native-${{ matrix.arch }}

    它没有把 native BuildKit 缓存发布到腾讯云 TCR。广州的 mo-nightly-regression 属于另一个仓库和 runner 环境,不能直接复用 MatrixOne 仓库的 GHA 缓存,所以新 commit 在缓存未命中时仍会冷构建并访问 GitHub 下载 ONNX。

    建议的根治方案

    将缓存生产和消费分开:

    MatrixOne main native CI(GitHub-hosted runner)
            │ 构建 native stage
            │ cache-to: type=registry
            ▼
    腾讯云 TCR BuildKit native cache
            │ cache-from: type=registry
            ▼
    广州 mo-nightly-regression(只读消费)
    

    具体建议:

    1. MatrixOne main native CI 作为唯一缓存生产者

      • 继续使用网络正常的 GitHub-hosted runner 构建 optools/images/Dockerfile 的 native stage。
      • 仅在受保护的 push main 事件登录 TCR,并将 amd64/arm64 缓存分别导出到稳定的 TCR cache tag。
      • PR 构建只做验证,不接触 TCR 写凭据、不写共享缓存。
    2. 广州 nightly 只读取 TCR 缓存

      • 使用 cache-from: type=registry,ref=<tcr>/buildcache-native-amd64。
      • 不在广州执行 cache-to,也不让广州 runner 承担冷缓存生产。
      • 对当前 main,如果预期缓存不存在,明确失败或等待 main native CI 生产完成,不再静默回退到 GitHub 冷下载。
      • 对历史上没有 native stage 的分支保留兼容路径。
    3. 保证生产端与消费端的缓存键一致

      • 对齐 platform、Dockerfile、build context、build args 和基础镜像内容/摘要。
      • thirdparties/**、cgo/**、Dockerfile、基础镜像或相关构建参数变化时,由 MatrixOne main CI 自动重新生成缓存;未变化时 RUN make -C thirdparties 应直接命中 CACHED。
    4. 凭据与权限

      • MatrixOne 仓库需要配置 TCR 登录凭据。
      • 写权限仅开放给 main 的受保护 workflow;nightly 使用只读凭据。

    对现有 nightly PR 的调整

    mo-nightly-regression#1328 已验证 registry cache 方向,但当前实现仍尝试让广州 runner 在冷缓存时生成并写回缓存。建议调整为:

    • 删除广州侧 cache-to;
    • 保留 TCR cache-from;
    • 增加缓存存在性检查及明确的冷缓存失败提示;
    • 由 MatrixOne main native CI 负责首次生成及后续更新。

    这样不会修改 ONNX URL、thirdparties/Makefile 或开源用户的下载行为,同时能把 ONNX 下载和 native 编译从广州 runner 的关键路径中移除。

  6. gouhongshen commented on Aug 14, 2026

    @gouhongshen
    Contributor

    Reopened with a recurrence outside PR #27134's scope.

    The MatrixOne ALL CI coverage run 31755103070, job 94629148612 failed before any Go test ran or a JSON test report was produced. Its self-hosted runner is behind the CI HTTPS proxy and make thirdparties invoked:

    thirdparties/download "https://github.com/matrixorigin/thirdparty/raw/655365097e21c4df0f82337063f9a12b66700593/onnxrt/1.26.0/linux_x64/lib/libonnxruntime.so.1.26.0" ...
    

    The 23,023,576-byte ONNX Runtime download reached only 3,465,408 bytes, then exited after 119,108 ms with curl: (28) Operation timed out; subsequent retries ended in connection/SSL timeouts. The runner later also failed three attempts to clone matrixorigin/CI with GnuTLS handshake termination, corroborating runner-proxy connectivity loss rather than a MatrixOne test failure.

    The current thirdparties/download still defaults MO_DOWNLOAD_MAX_TIME_SECONDS to 120; the intended fix in closed, unmerged PR #26671 raised that limit and added a low-speed timeout. PR #27134 changes only snapshot-scope code/tests and does not touch the downloader or its inputs.

    This is the same source, artifact version, hard transfer limit, and curl-28 behavior documented in this issue. The failed job will be retried once under its attempt-1 workflow policy.

  7. added a commit that references this issue on Aug 19, 2026
    1d50033
  8. added 3 commits that reference this issue on Sep 17, 2026
    3deb703
    59db4e1
    28d3e04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions