bug: agent bootstrap script can't overwrite in-use coder binary (curl error 23 / ETXTBSY)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- shell
- Lĩnh vực
- devops, infrastructure
Hướng nghiên cứu
Bắt đầu với provisionersdk/scripts/bootstrap_linux.sh và kiểm tra vòng lặp tải xuống cùng các nhánh curl, wget và busybox wget của nó. Tái hiện trường hợp BINARY_DIR persistent với một binary coder đang được sử dụng, sau đó xác minh rằng bootstrap khôi phục sau lỗi tải xuống thay vì thử lại vô thời hạn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Go
- Star
- 16.6k
- Fork
- 1.6k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 543
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của coder/coder
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
-
feat(site): suppress the web terminal context menu when the application has enabled mouse tracking Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
bug site
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Issue tương tự
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
microsoft/agent-framework-go#1179 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
[Bug]: OLLAMA_KEEP_ALIVE="5m" / "24h" crashes Ollama embedding and vision models with ValueError Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
infiniflow/ragflow#20223 · 1 reaction ·
-
bug needs triage pkg/translator/faro
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
open-telemetry/opentelemetry-collector-contrib#51484 · 1 bình luận ·