Skip to content

only close plugin server if actually created #6123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

ndeloof
Copy link
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

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