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

oci: cleanup log path if the container failed to create #5800

Merged
merged 1 commit into from Apr 22, 2022

Conversation

haircommander
Copy link
Member

Signed-off-by: Peter Hunt pehunt@redhat.com

What type of PR is this?

/kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

fix a bug where CRI-O would leak a log file if a container failed to be created and the pod hadn't yet been cleaned up. 

@openshift-ci openshift-ci bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Apr 13, 2022
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 13, 2022
@mrunalp
Copy link
Member

mrunalp commented Apr 13, 2022

integration failure:

not ok 53 ctr log cleaned up if container create failed
# (in test file ./ctr.bats, line 184)
#   `ls "$DEFAULT_LOG_PATH/$pod_id"/*' failed with status 2


@haircommander
Copy link
Member Author

integration failure:

not ok 53 ctr log cleaned up if container create failed
# (in test file ./ctr.bats, line 184)
#   `ls "$DEFAULT_LOG_PATH/$pod_id"/*' failed with status 2

oopsies, inverted boolean expression

@haircommander haircommander added this to the 1.24 milestone Apr 14, 2022
@rphillips
Copy link
Contributor

lgtm

Copy link
Member

@mrunalp mrunalp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 14, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 14, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, mrunalp

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:
  • OWNERS [haircommander,mrunalp]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rphillips
Copy link
Contributor

/cherry-pick release-1.23

@openshift-cherrypick-robot

@rphillips: once the present PR merges, I will cherry-pick it on top of release-1.23 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.23

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

7 similar comments
@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@littlejawa
Copy link
Contributor

@haircommander - the kata-jenkins job keeps failing on the test you added.
I could verify it locally, and there is indeed a couple log files remaining (one which name matches the pod_id, and another one with a different ID).

The cleanup code you added in runtime_vm.go should have removed the first at least right?
I'm not sure about the other though.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@littlejawa
Copy link
Contributor

How can we prevent Github from repeating a CI job again and again?
The CI is actually reporting an issue. Until we fix it, it will just keep failing.

@haircommander
Copy link
Member Author

/hold

Will do the trick

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 15, 2022
@@ -749,6 +749,9 @@ func (r *runtimeVM) createContainerIO(ctx context.Context, c *Container, cioOpts
defer func() {
if retErr != nil {
containerIO.Close()
if err := os.Remove(c.logPath); err != nil {
log.Warnf(ctx, "Failed to remove log path %s after failed to create container: %v", c.logPath, err)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in CreateContainer() rather than createContainerIO() ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hahaha right! fixed 😅

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 18, 2022
defer func() {
if retErr != nil {
if err := os.Remove(c.logPath); err != nil {
log.Warnf(ctx, "Failed to remove log path %s after failed to create container: %v", c.logPath, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
log.Warnf(ctx, "Failed to remove log path %s after failed to create container: %v", c.logPath, err)
log.Warnf(ctx, "Failed to remove log path %s after failure to create container: %v", c.logPath, err)

or perhaps "failing"

@@ -134,6 +134,9 @@ func (r *runtimeVM) CreateContainer(ctx context.Context, c *Container, cgroupPar
if cleanupErr := r.deleteContainer(c, true); cleanupErr != nil {
log.Infof(ctx, "DeleteContainer failed for container %s: %v", c.ID(), cleanupErr)
}
if err := os.Remove(c.logPath); err != nil {
log.Warnf(ctx, "Failed to remove log path %s after failed to create container: %v", c.logPath, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you change prior, change there too.

@haircommander haircommander force-pushed the log-cleanup branch 2 times, most recently from 0db01ee to d6783f9 Compare April 21, 2022 03:22
@haircommander
Copy link
Member Author

/hold cancel

rebased to fix ci PTAL @cri-o/cri-o-maintainers

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 21, 2022
@haircommander
Copy link
Member Author

/hold cancel

Signed-off-by: Peter Hunt <pehunt@redhat.com>
@haircommander
Copy link
Member Author

/retest

@QiWang19
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 22, 2022
@openshift-merge-robot openshift-merge-robot merged commit a68a720 into cri-o:main Apr 22, 2022
@openshift-cherrypick-robot

@rphillips: new pull request created: #5817

In response to this:

/cherry-pick release-1.23

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants