Skip to content
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

plugins: don't panic on Close if PluginServer nil #5327

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

laurazard
Copy link
Member

@laurazard laurazard commented Aug 7, 2024

fixes #5317

- What I did

We had a report in fixes #5317 of a panic at

pl.mu.Lock()

Looks like this will happen if the call to create a PluginServer fails and returns nil, since we're not checking for nilness before attempting to call Close:

cli/cmd/docker/docker.go

Lines 247 to 251 in 87c6624

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()
}()

_ = srv.Close()

- How I did it

Added a nil check to PluginServer.Close(). We could also have addressed this at the caller sites, but this seems more robust for little cost.

- How to verify it

- Description for the changelog

Fixed issue where main CLI process would sometimes panic while running a plugin.

- A picture of a cute animal (not mandatory but encouraged)

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.45%. Comparing base (87c6624) to head (9c44806).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5327   +/-   ##
=======================================
  Coverage   61.45%   61.45%           
=======================================
  Files         299      299           
  Lines       20855    20857    +2     
=======================================
+ Hits        12816    12818    +2     
  Misses       7124     7124           
  Partials      915      915           

@laurazard
Copy link
Member Author

Wondering if we should also backport this to 26.1.

@vvoland vvoland added this to the 28.0.0 milestone Aug 7, 2024
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

@thaJeztah
Copy link
Member

Wondering if we should also backport this to 26.1.

It's probably ok to cherry-pick; we may not be doing releases from that branch, but a cherry-pick doesn't do harm

@thaJeztah thaJeztah merged commit 0052d2c into docker:master Aug 7, 2024
110 checks passed
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.

[BUG] SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1007d0440
4 participants