Skip to content

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

Merged
thaJeztah merged 1 commit into
docker:masterfrom
laurazard:fix-panic-pluginserver
Aug 7, 2024
Merged

plugins: don't panic on Close if PluginServer nil#5327
thaJeztah merged 1 commit into
docker:masterfrom
laurazard:fix-panic-pluginserver

Conversation

@laurazard

@laurazardlaurazard commented Aug 7, 2024

Copy link
Copy Markdown
Member

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

deferfunc() {
// 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)

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
@codecov-commenter

Copy link
Copy Markdown

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
Copy Markdown
MemberAuthor

Wondering if we should also backport this to 26.1.

@vvolandvvoland added this to the 28.0.0 milestone Aug 7, 2024

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

@thaJeztah

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

Sign up for freeto 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

@laurazard@codecov-commenter@thaJeztah@vvoland