Skip to content

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

Open
aniket866 wants to merge 1 commit into
microcks:masterfrom
aniket866:fixing-null-pointer-deref-executor
Open

The watcher daemon crashes with a stack trace instead of handling the connection/context resolution failure gracefully.#496
aniket866 wants to merge 1 commit into
microcks:masterfrom
aniket866:fixing-null-pointer-deref-executor

Conversation

@aniket866

Copy link
Copy Markdown
Contributor

Closes #475

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.

Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nil Pointer Dereference in Watcher Executor -> dereference panic.

1 participant