Skip to content

Nil Pointer Dereference in Watcher Executor -> dereference panic. #475

Description

@aniket866

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)
Loading

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions