bug: agent bootstrap script can't overwrite in-use coder binary (curl error 23 / ETXTBSY)
まだ誰も着手していません。
評価
- 難易度
- 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日 21時間
- マージ済み PR(30日)
- 527
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
prometheus/procfs#872 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bazel-contrib/rules_go#4726 · コメント 1 件 ·
-
area/auto-scaling area/monitoring area/ops-productivity kind/enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100