Skip to content

fix: prevent docker_pull wait error loop - #22

Open
lln556 wants to merge 1 commit into
xiaoyaDev:masterfrom
lln556:fix/docker-pull-wait-loop
Open

fix: prevent docker_pull wait error loop#22
lln556 wants to merge 1 commit into
xiaoyaDev:masterfrom
lln556:fix/docker-pull-wait-loop

Conversation

@lln556

@lln556 lln556 commented Jul 30, 2026

Copy link
Copy Markdown

问题

docker_pull() 在命令替换中使用无参数 wait。脚本同时通过 start_push_proc 保持一个长期后台任务;在当前镜像的 Bash 5.3.3 中,命令替换子 shell 会尝试等待这个不属于自己的 PID,并陷入高速错误循环:

wait: pid ... is not a child of this shell

实际故障中,该循环在约 68 分钟内生成了 17.1 GB Docker 日志。

修复

  • 启动镜像源测速 curl 时记录本批进程的 PID
  • 只逐个等待这些 PID,不再使用无参数 wait
  • 保留原有并发测速和输出收集行为

Fixes #21

验证

  • bash -n aliyun_clear.sh
  • sh -n aliyun_clear.sh
  • git diff --check
  • 使用仓库 Dockerfile 完整构建镜像成功
  • 从构建镜像中提取实际 docker_pull(),在 Bash 5.3.3 环境中保留父后台任务并模拟两个并发测速进程:
    • 修复前:2 秒产生 388129 行、20766704 字节 stderr,进程超时
    • 修复后:状态码 0、stderr 0 字节、两个测速进程均完成

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] docker_pull 的无参数 wait 可能陷入错误循环并写满日志

1 participant