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

libpod: do not leak systemd hc startup unit timer #22895

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Jun 4, 2024

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?

Fixed a regression from v5.1.0 which caused systemd startup healthcheck timer units to be leaked even after the container is stopped.

Copy link
Contributor

openshift-ci bot commented Jun 4, 2024

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 4, 2024
@Luap99
Copy link
Member Author

Luap99 commented Jun 4, 2024

@mheon PTAL

@mheon
Copy link
Member

mheon commented Jun 4, 2024

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]>
@Luap99 Luap99 force-pushed the hc-startup-leak branch from a406d50 to e8ea1e7 Compare June 4, 2024 16:09
@@ -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
Copy link
Member

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?

Copy link
Member Author

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

@baude
Copy link
Member

baude commented Jun 4, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 4, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit b637678 into containers:main Jun 4, 2024
89 checks passed
@Luap99 Luap99 deleted the hc-startup-leak branch June 4, 2024 17:45
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 3, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Sep 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HealthCmd interval in quadlet not being followed + transient timers not cleaned up
4 participants