Nil Pointer Dereference in Watcher Executor -> dereference panic.

Đang mở Phù hợp với người mới
#475 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
84/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
cli

Hướng nghiên cứu

Đọc pkg/watcher/executor.go và bắt đầu từ TriggerImport, lần theo nhánh lỗi của connectors.NewClient trước khi mc.UploadArtifact được gọi. Tái hiện vấn đề với một context không hợp lệ hoặc đã hết hạn cùng với một thay đổi ở tệp được theo dõi, sau đó xác minh rằng watcher xử lý lỗi của client mà không xảy ra nil-pointer panic.

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

Mô tả

stale
Describe the bug
Diagram
sequenceDiagram
    participant Watcher
    participant Executor
    participant Client as connectors.NewClient
    Watcher->>Executor: TriggerImport(entry)
    Executor->>Client: NewClient(*globalClientOpts)
    Note over Client: Fails (e.g. invalid context)
    Client-->>Executor: nil, err
    Note over Executor: Logs error, but DOES NOT return!
    Executor->>Executor: mc.UploadArtifact(entry.FilePath, entry.MainArtifact)
    Note over Executor: Panic: nil pointer dereference (mc is nil)
Description

In pkg/watcher/executor.go, the TriggerImport function instantiates the Microcks client using connectors.NewClient. If this fails (e.g., due to an invalid context or server address), it prints an error message but continues execution instead of returning early. It subsequently calls mc.UploadArtifact(), causing a nil pointer dereference panic.

Impact

The watcher daemon crashes with a stack trace instead of handling the connection/context resolution failure gracefully.

Steps to Reproduce
  1. Configure a watch entry with an invalid or expired context.
  2. Modify the watched file to trigger an fsnotify event.
  3. The watch manager invokes TriggerImport, which prints [ERROR] Cannot connect to Microcks client... and immediately panics with a segmentation fault.

Ngôn ngữ chính
Go
Star
52
Fork
67
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
13

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 microcks/microcks-cli

Tất cả issue của microcks/microcks-cli

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.