Skip to content

Fix missing error check in ContainerTop on Windows - #52025

Merged
thaJeztah merged 1 commit into
moby:masterfrom
jack0x2:fix-top-windows-nil-task-panic
Feb 10, 2026
Merged

thaJeztah merged 1 commit into
moby:masterfrom
jack0x2:fix-top-windows-nil-task-panic

Conversation

@jack0x2

@jack0x2 jack0x2 commented Feb 10, 2026 •

Copy link
Copy Markdown
Contributor

- What I did

Fixed a missing error check in ContainerTop on Windows that could cause a nil pointer panic.

- How I did it

Added an if err != nil check after the IIFE that acquires the running task under lock in daemon/top_windows.go. Previously, if GetRunningTask() failed (e.g., container not running) or the container was in a restarting state, the error was silently dropped and task.Summary() was called on a nil task, resulting in a panic.

- How to verify it

  1. Run docker top against a stopped or restarting Windows container.
  2. Before this fix: nil pointer panic.
  3. After this fix: a proper error message is returned.

This matches the existing error handling pattern in daemon/top_unix.go.

- Human readable description for the release notes

Fix a panic when running `docker top` on a non-running Windows container.

Signed-off-by: Jack Phillips <jack.phillips@datadoghq.com>
@jack0x2
jack0x2 force-pushed the fix-top-windows-nil-task-panic branch from e78e538 to 146c702 Compare February 10, 2026 17:36
@thaJeztah thaJeztah added this to the 29.2.2 milestone Feb 10, 2026

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx!

@thaJeztah
thaJeztah merged commit 6afcae9 into moby:master Feb 10, 2026
185 of 186 checks passed
@jack0x2
jack0x2 deleted the fix-top-windows-nil-task-panic branch February 10, 2026 20:46
@vvoland vvoland modified the milestones: 29.2.2, 29.3.0 Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants