fix(daemon): daemon stop reports a failed stop for a daemon that exits just before SIGTERM
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ó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
Bắt đầu từ internal/daemon/stop.go, trong stopTargets, nơi lỗi từ stopSignal được nối vào lỗi gộp. Bên gửi POSIX là sendStop trong internal/daemon/stop_posix.go. Quyết định xem kết quả os.ErrProcessDone được tính là đã dừng hay bị bỏ qua, rồi xử lý nó bằng errors.Is. Hoàn thành khi một bài kiểm thử tiêm os.ErrProcessDone qua điểm nối stopSignal cho thấy daemon stop không trả về lỗi nào.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
stopTargets (internal/daemon/stop.go) checks each record with isStale, and then sends SIGTERM through stopSignal. On POSIX that is sendStop (internal/daemon/stop_posix.go): os.FindProcess(pid), then proc.Signal(syscall.SIGTERM).
A daemon can exit between the isStale check and the signal. proc.Signal then returns os.ErrProcessDone ("os: process already finished"), and stopTargets adds it to the joined error:
if err := stopSignal(rec.PID); err != nil {
errs = append(errs, fmt.Errorf("stopping pid %d: %w", rec.PID, err))
continue
}
So codegraph daemon stop exits 1 with stopping pid N: os: process already finished, although the daemon is gone, which is what the user asked for. With #179, a stop that stopped nothing and failed prints nothing on stdout, so the user sees only that error.
Evidence
- A scratch program in the suite review of #179 showed that SIGTERM to an exited pid returns
os.ErrProcessDone. - The race was not reproduced through the command itself. The window between
isStaleand the signal is short.
Possible direction
- In
stopTargets, handleerrors.Is(err, os.ErrProcessDone)without adding an error. - Decide whether such a record counts as stopped (the process is gone, so
stopped pid Nis true) or is skipped like a stale record. - Add a test through the
stopSignalseam that returnsos.ErrProcessDone.
Found by the silent-failure reviewer in the suite review of #179 (finding QUAL-4, PLAUSIBLE). The code predates #179.
🤖 Generated with Claude Code
- Ngôn ngữ chính
- Go
- Star
- 0
- Fork
- 0
- Merge trung bình
- 7 giờ 42 phút
- Pull request đã merge (30 ngày)
- 111
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 seanb4t/codegraph-go
-
chore needs-triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
seanb4t/codegraph-go#380 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
seanb4t/codegraph-go#379 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:query chore needs-triage spec-needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
seanb4t/codegraph-go#377 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore needs-triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 84/100
seanb4t/codegraph-go#362 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:query bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
seanb4t/codegraph-go#355 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của seanb4t/codegraph-go
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
automated documentation maintenance
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 75/100
github/gh-aw-mcpg#16717 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Docs: Recording rules pages don't say what happens to a recorded metric when its rule is deletedĐang mởinternal
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
jesseduffield/lazygit#6229 ·
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 72/100
prometheus/prometheus#20482 ·
Maintainer thường phản hồi trong vòng 2 ngày