[Bug]: CDI spec WriteTo leaks the temporary descriptor on save errors
Maintainer thường phản hồi trong vòng 5 ngà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
- 35/100
Hướng nghiên cứu
Start at spec.Interface.WriteTo in the pkg/nvcdi/spec package and trace the temporary-file cleanup and close paths when saving fails. The issue gives a reproducer using an invalid CDI version and io.Discard; use it to confirm that failed writes close the descriptor and remove the temporary file. An open linked pull request (#2140) is already addressing this issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
spec.Interface.WriteTo leaves the temporary file descriptor open when saving the CDI specification fails. The temporary pathname is removed, but the descriptor is only reclaimed by Go's file finalizer.
On current main (023f35906ee23384b48dc3db3f2d1fb75d29f6b0), eight failed writes leave eight open, deleted nvcdi-spec-*.yaml descriptors when garbage collection is disabled. This affects callers that reuse the public library after a validation or filesystem error.
To Reproduce
Run the following from a module that imports the toolkit:
package main
import (
"io"
"runtime/debug"
"github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec"
)
func main() {
debug.SetGCPercent(-1) // Make descriptor cleanup independent of finalizers.
s, err := spec.New(spec.WithVersion("invalid"))
if err != nil {
panic(err)
}
for i := 0; i < 8; i++ {
_, err := s.WriteTo(io.Discard)
if err == nil {
panic("expected CDI validation failure")
}
}
select {} // Inspect /proc/<pid>/fd in another terminal.
}
Each failed write reports failed to write spec: invalid CDI Spec: invalid version "invalid". /proc/<pid>/fd contains eight temporary CDI files with the (deleted) suffix. No temporary pathname remains on disk.
Expected behavior
Every return from WriteTo should close the temporary file descriptor, including failures before the existing explicit tmpFile.Close() call. The original save error and temporary-file cleanup should be preserved.
Environment
- Toolkit: current main at
023f35906ee23384b48dc3db3f2d1fb75d29f6b0 - Linux amd64, Go 1.26.0
- Reproduction uses the public Go API; GPU, driver, and container-runtime operations are not involved.
Additional information
The error is reproducible without GPU hardware. I plan to add a focused regression that separately checks open descriptors and remaining temporary files, and ensure the temporary descriptor is closed on the save-error path.
- Ngôn ngữ chính
- Go
- Star
- 4.6k
- Fork
- 605
- Merge trung bình
- 7 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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 NVIDIA/nvidia-container-toolkit
-
Address TODO comments in internal/platform-support/dgpu/dgpu.goCó thể đã có người làm @truongbo17 đã nhận 22 ngày trước. Đang mởdsx-ws-0930 good-first-issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NVIDIA/nvidia-container-toolkit#2114 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
[Bug]: nvidia-ctk runtime configure --runtime=docker without --set-as-default leaves default-runtime set to nvidiaCó thể đã có người làm @blacksoxx đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
NVIDIA/nvidia-container-toolkit#2155 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
[Bug]: Containerized installer removes the existing Toolkit installation before the replacement is complete and durableCó thể đã có người làm @henry118 đã nhận 2 ngày trước. Đang mởbug needs-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
NVIDIA/nvidia-container-toolkit#2153 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
NVIDIA/nvidia-container-toolkit#2147 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 47/100
NVIDIA/nvidia-container-toolkit#2137 ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của NVIDIA/nvidia-container-toolkit
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
keyxmakerx/Chronicle#1721 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Gentleman-Programming/gentle-ai#5720 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
compress: block buffers get re-zeroed on every call, and the zeroing is immediately overwrittenĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ClickHouse/ch-go#1218 ·
Maintainer thường phản hồi trong vòng 13 ngày
-
effort:s impact:low raised-by:reviewer risk:low
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
medici-finance/assay#4251 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
stripCodeFence unti testsĐang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Edwin-metcalf/MetCode#30 ·
Maintainer thường phản hồi trong vòng 1 ngày