-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
libpod: do not leak systemd hc startup unit timer #22895
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Luap99 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@mheon PTAL |
LGTM |
This fixes a regression added in commit 4fd8419, because the name was overwritten by the createTimer() timer call the removeTransientFiles() call removed the new timer and not the startup healthcheck. And then when the container was stopped we leaked it as the wrong unit name was in the state. A new test has been added to ensure the logic works and we never leak the system timers. Fixes containers#22884 Signed-off-by: Paul Holzinger <[email protected]>
@@ -278,6 +278,7 @@ func (c *Container) incrementStartupHCSuccessCounter(ctx context.Context) { | |||
if recreateTimer { | |||
logrus.Infof("Startup healthcheck for container %s passed, recreating timer", c.ID()) | |||
|
|||
oldUnit := c.state.HCUnitName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need a temporary variable for this value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is the whole point of the bug fix, as written in the commit message createTimer() will overwrite this with a new value thus removeTransientFiles() removed the new unit not the old one.
Maybe I should have added this in a comment there to make it clear
/lgtm |
This fixes a regression added in commit 4fd8419, because the name was overwritten by the createTimer() timer call the removeTransientFiles() call removed the new timer and not the startup healthcheck. And then when the container was stopped we leaked it as the wrong unit name was in the state.
A new test has been added to ensure the logic works and we never leak the system timers.
Fixes #22884
Does this PR introduce a user-facing change?