bug: agent bootstrap script can't overwrite in-use coder binary (curl error 23 / ETXTBSY)
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- shell
- 领域
- devops, infrastructure
调研方向
从 provisionersdk/scripts/bootstrap_linux.sh 开始,检查下载循环以及其中的 curl、wget 和 busybox wget 分支。使用正在使用中的 coder 二进制文件复现持久化 BINARY_DIR 的情况,然后验证 bootstrap 能从下载失败中恢复,而不是无限重试。
由索引模型根据 Issue 内容生成。
描述
Summary
When the agent bootstrap script runs against a BINARY_DIR that persists across workspace restarts (notably envbox, which sets BINARY_DIR=$HOME/.coder — see envbox/cli/docker.go), curl can fail to overwrite the existing coder binary if anything still holds a reference to it. This produces curl: (23) Failure writing output to destination and the bootstrap loop never recovers.
Reproduction
- Run a workspace using envbox (sysbox-based). Inner-container workload doesn't strictly matter, but heavy/leaky workloads such as a kind cluster running Argo/Grafana/Loki/Mimir/Tempo make it much more likely to trigger.
- Force-delete the workspace pod without graceful shutdown (e.g.
kubectl delete pod ... --force --grace-period=0), simulating a stuck/unresponsive workspace. - Restart the workspace.
- The bootstrap script enters the curl retry loop and never recovers:
+ curl -fsSL --compressed https://<access-url>/bin/coder-linux-amd64 -o coder
curl: (23) Failure writing output to destination
+ status=23
+ echo error: failed to download coder agent
+ echo command returned: 23
+ echo Trying again in 30 seconds...
+ sleep 30
Root cause
provisionersdk/scripts/bootstrap_linux.sh does:
curl -fsSL --compressed "${BINARY_URL}" -o "${BINARY_NAME}" && break
without first removing the existing destination file. When BINARY_DIR persists and the old coder binary still has an open reference (e.g. ETXTBSY — "text file busy" — from a process the orphaned/force-killed pod left behind), the kernel refuses to overwrite the running executable and curl returns 23 indefinitely.
The workaround that resolves it is manually running rm -f $HOME/.coder/coder inside the inner container before retrying.
Suggested fix
In bootstrap_linux.sh, before the download loop, either:
rm -f "${BINARY_NAME}", or- download to a temp filename and
mvinto place (atomic replace, also avoids partial-download issues).
The same treatment should be applied to the wget / busybox wget branches.
Impact
Workspaces relying on a persistent BINARY_DIR (envbox is the main case) can become permanently stuck in the bootstrap retry loop after any unclean shutdown, with no actionable error surfaced in the UI. The only recovery today is exec-ing into the inner container and removing the binary by hand.
Created on behalf of @ericpaulsen.
- 主要语言
- Go
- 星标
- 16.6k
- 派生
- 1.6k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 543
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
coder/coder 的其他 Issue
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist 未关闭bug
难度 2/5 1-3 小时 新手友好度 90/100
-
feat(site): suppress the web terminal context menu when the application has enabled mouse tracking 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
-
bug frontend
难度 2/5 1-3 小时 新手友好度 84/100
-
bug site
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 85/100
相似的 Issue
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 76/100
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 70/100
microsoft/agent-framework-go#1179 ·
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
-
[Bug]: OLLAMA_KEEP_ALIVE="5m" / "24h" crashes Ollama embedding and vision models with ValueError 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
infiniflow/ragflow#20223 · 1 个 reaction ·
-
bug needs triage pkg/translator/faro
难度 2/5 1-3 小时 新手友好度 88/100
open-telemetry/opentelemetry-collector-contrib#51484 · 1 条评论 ·