CoderWorkspacePool: use after the last read can still be bound or deleted on a delete retry

Đã đóng
#409 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
28/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, kubernetes
Lĩnh vực
backend

Hướng nghiên cứu

Read the two threads on PR #404 first, then bindClaims in internal/controller/coderworkspacepool_claim.go and cleanupStep in internal/controller/coderworkspacepoolmember_cleanup.go to see where each check sits relative to the delete/bind boundary. Before writing anything, answer the open question in the issue: does Coder move last_used_at on a failed delete build? A failed-delete test against the member cleanup path is the place to establish that. Done means both paths re-check use at the boundary, existing reconciler tests still pass, and the residual flush-delay window is documented.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

Two paths can still hand out or delete a pool workspace that someone used after the member's last read of Coder. Codex found both on #404. Both exist on main and are outside #349, which #404 fixes.

  1. Bind uses stored status. bindClaims (internal/controller/coderworkspacepool_claim.go) picks members by their stored Ready and Used conditions. A member reads last_used_at once a minute. Use after that read and before the next one is not in status yet, so a new claim can bind the workspace. The resourceVersion precondition cannot see a change in Coder. Thread: https://github.com/coder/coder-k8s/pull/404#discussion_r4424757093
  2. No use check before a delete retry. cleanupStep (internal/controller/coderworkspacepoolmember_cleanup.go) runs the last use check only before the first delete build (DeleteBuildID == "" && DeleteAttempts == 0). If that build fails or is canceled and someone uses the workspace during the retry backoff, the retry deletes it. Thread: https://github.com/coder/coder-k8s/pull/404#discussion_r4424757101

Neither path can close the gap fully. Coder records use up to one usage flush (about 60 s) late, and it has no conditional delete or bind. The fixes narrow the window to that flush delay.

Possible fix

  1. Read the workspace from Coder at the bind boundary and skip a member whose last_used_at is past its readyLastUsedAt.
  2. Run the last use check before every new delete build, not only the first. Check first whether Coder moves last_used_at on a failed delete build. If it does, every failed delete would release its member (a leak, the fail-safe side).

Trigger

Before #153 PR 12 registers the pool reconcilers.

Owner: maintainer desk.

Refs #153
Refs #404


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

Ngôn ngữ chính
Go
Star
5
Fork
3
Merge trung bình
2 giờ 49 phút
Pull request đã merge (30 ngày)
206

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của coder/coder-k8s

Tất cả issue của coder/coder-k8s

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.