Skip to content

only close plugin server if actually created#6123

Merged
thaJeztah merged 1 commit intodocker:masterfrom
ndeloof:pluginserver
Jun 10, 2025
Merged

only close plugin server if actually created#6123
thaJeztah merged 1 commit intodocker:masterfrom
ndeloof:pluginserver

Conversation

@ndeloof
Copy link
Copy Markdown
Contributor

@ndeloof ndeloof commented Jun 6, 2025

- What I did
don't defer srv.Close() if srv was not successfully created (nil pointer)

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 6, 2025

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 55.04%. Comparing base (9e50654) to head (b9c563a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6123   +/-   ##
=======================================
  Coverage   55.03%   55.04%           
=======================================
  Files         361      361           
  Lines       30153    30152    -1     
=======================================
  Hits        16596    16596           
+ Misses      12599    12598    -1     
  Partials      958      958           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vvoland vvoland added this to the 28.2.3 milestone Jun 10, 2025
Comment thread cmd/docker/docker.go
defer func() {
// Close the server when plugin execution is over, so that in case
// it's still open, any sockets on the filesystem are cleaned up.
_ = srv.Close()
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.

There's another call to srv.Close() further down; that one should probably be gated by a if srv != nil as well;

cli/cmd/docker/docker.go

Lines 331 to 337 in 9e50654

// Terminate the plugin server, which will
// close all connections with plugin
// subprocesses, and signal them to exit.
//
// Repeated invocations will result in EINVAL,
// or EBADF; but that is fine for our purposes.
_ = srv.Close()

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@thaJeztah thaJeztah merged commit 5487986 into docker:master Jun 10, 2025
87 checks passed
@thaJeztah thaJeztah modified the milestones: 28.2.3, 28.3.0 Jun 13, 2025
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.

5 participants