Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dsxing
Copy link
Contributor

@dsxing dsxing commented Feb 2, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

Although there is a PR #6153 to fix issue #5490, but the problem still persists (see: #5490 (comment)). The root cause of the issue is that after crio restarts, the data for infraContainers is lost as it is stored in memory(https://github.com/cri-o/cri-o/blob/main/internal/lib/container_server.go#L585). During the restore process, the sandbox and containers are reconstructed and restored through LoadSandbox and LoadContainer in restore funtion(https://github.com/cri-o/cri-o/blob/main/server/server.go#L222-L279), but the infraContainers are not restored during LoadSandbox.

As a result, when kubelet cadvisor queries and retrieves infraContainer information, it returns an errCtrNotFound error(https://github.com/cri-o/cri-o/blob/main/server/inspect.go#L68), causing kubelet cadvisor to continuously log error messages.

If we rebuild and restore the infraContainers data when restarting crio, which is necessary, it won't cause cadvisor to fail to retrieve data and, consequently, won't lead to print error log

Which issue(s) this PR fixes:

fixes #5490

Special notes for your reviewer:

Does this PR introduce a user-facing change?

None

Restore infra containers state on CRI-O restart. Without this, the infra containers will be accounted as missing, leading to a spurious error message.

@dsxing dsxing requested a review from mrunalp as a code owner February 2, 2024 02:42
@openshift-ci openshift-ci bot added 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. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 2, 2024
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 2, 2024

Hi @dsxing. Thanks for your PR.

I'm waiting for a cri-o member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@kwilczynski
Copy link
Contributor

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 2, 2024
@kwilczynski
Copy link
Contributor

/approve

@kwilczynski
Copy link
Contributor

/release-note-none

@openshift-ci openshift-ci bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Feb 2, 2024
@kwilczynski
Copy link
Contributor

/retest-required

2 similar comments
@dsxing
Copy link
Contributor Author

dsxing commented Feb 2, 2024

/retest-required

@kwilczynski
Copy link
Contributor

/retest-required

}

// We should restore the infraContainer to the container state store
c.AddInfraContainer(ctx, scontainer)
Copy link
Member

Choose a reason for hiding this comment

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

Is it feasible to add test coverage for this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

@sohankunkerkar, I was wondering about this.

This seems like an obvious thing to do. So I wonder why we didn't in the past? Perhaps indeed a bug.

Copy link
Contributor

Choose a reason for hiding this comment

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

Obvious thing to do, as in, load infra containers on restart.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it feasible to add test coverage for this change?

can we add a unit test to check if the infraContainer is loaded? like this:
https://github.com/cri-o/cri-o/pull/7726/files#diff-5df3a97ff31edf6084a160b044038d23d5ef6d2ab76f5ad0e5b57d059c37bdbcR160

@sohankunkerkar
Copy link
Member

We might need a release note if it's a bug.

@kwilczynski
Copy link
Contributor

/remove-label release-note-none

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 2, 2024

@kwilczynski: The label(s) /remove-label release-note-none cannot be applied. These labels are supported: acknowledge-critical-fixes-only, platform/aws, platform/azure, platform/baremetal, platform/google, platform/libvirt, platform/openstack, ga, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, px-approved, docs-approved, qe-approved, no-qe, downstream-change-needed, rebase/manual, cluster-config-api-changed, approved, backport-risk-assessed, bugzilla/valid-bug, cherry-pick-approved, jira/valid-bug, staff-eng-approved. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?

Details

In response to this:

/remove-label release-note-none

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.

@kwilczynski
Copy link
Contributor

/release-note-edit release-note Restore infra containers state on CRI-O restart. Without this, the infra containers will be accounted as missing, leading to a spurious error message.

@openshift-ci openshift-ci bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Feb 2, 2024
@haircommander
Copy link
Member

wow! great investigation and find!
/approve

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

one day, I'd love to consolidate the restore and creation flow so there's no way to miss pieces like this...

@kwilczynski
Copy link
Contributor

@haircommander, we would backport this to 1.29, correct?

@haircommander
Copy link
Member

we should backport it to all supported branches

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 5, 2024
@kwilczynski
Copy link
Contributor

/hold

@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 Feb 5, 2024
@dsxing dsxing force-pushed the restore-infracontainer branch from aeba836 to ff60ac1 Compare February 6, 2024 15:36
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 6, 2024
@kwilczynski
Copy link
Contributor

/unhold

@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 Feb 6, 2024
@kwilczynski
Copy link
Contributor

/approve

@dsxing
Copy link
Contributor Author

dsxing commented Feb 6, 2024

unit test seems to fail https://github.com/cri-o/cri-o/actions/runs/7778795849/job/21227832077?pr=7726

I made a small mistake in the unit test code which I added. It should query infraContainer with sandboxId.I think It's fixed now. can you help to retest again ,thanks

@kwilczynski
Copy link
Contributor

/retest-required

@haircommander
Copy link
Member

/retest
/approve

LGTM, thanks for finding this @dsxing

@codecov
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

Merging #7726 (ff60ac1) into main (5a2bbb9) will decrease coverage by 0.02%.
Report is 34 commits behind head on main.
The diff coverage is 18.62%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7726      +/-   ##
==========================================
- Coverage   47.97%   47.95%   -0.02%     
==========================================
  Files         145      146       +1     
  Lines       16268    16275       +7     
==========================================
+ Hits         7804     7805       +1     
+ Misses       7520     7517       -3     
- Partials      944      953       +9     

@kwilczynski
Copy link
Contributor

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 6, 2024
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dsxing, haircommander, kwilczynski

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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-merge-bot openshift-merge-bot bot merged commit 732df1b into cri-o:main Feb 6, 2024
@openshift-cherrypick-robot

@kwilczynski: new pull request created: #7749

Details

In response to this:

/cherry-pick release-1.29
/cherry-pick release-1.28
/cherry-pick release-1.27
/cherry-pick release-1.26
/cherry-pick release-1.25

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-cherrypick-robot

@kwilczynski: new pull request created: #7750

Details

In response to this:

/cherry-pick release-1.29
/cherry-pick release-1.28
/cherry-pick release-1.27
/cherry-pick release-1.26
/cherry-pick release-1.25

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-cherrypick-robot

@kwilczynski: new pull request created: #7751

Details

In response to this:

/cherry-pick release-1.29
/cherry-pick release-1.28
/cherry-pick release-1.27
/cherry-pick release-1.26
/cherry-pick release-1.25

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-cherrypick-robot

@kwilczynski: new pull request created: #7752

Details

In response to this:

/cherry-pick release-1.29
/cherry-pick release-1.28
/cherry-pick release-1.27
/cherry-pick release-1.26
/cherry-pick release-1.25

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-cherrypick-robot

@kwilczynski: new pull request created: #7753

Details

In response to this:

/cherry-pick release-1.29
/cherry-pick release-1.28
/cherry-pick release-1.27
/cherry-pick release-1.26
/cherry-pick release-1.25

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

Error log: Failed to create existing container

5 participants