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

Skip to content

Conversation

@haircommander
Copy link
Member

What type of PR is this?

/kind api-change
/kind bug
/kind ci
/kind cleanup
/kind dependency-change
/kind deprecation
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake
/kind other

What this PR does / why we need it:

There is a chance that a WatcherForResource() followed by a Get() would cause cri-o to segfault. Fix this
also extend the test suite to add a test for this and another situation, as well as move around the tests so they're all run

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

fixed a bug that could cause CRI-O to segfault when a node is under heavy load

@openshift-ci-robot openshift-ci-robot 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 Feb 2, 2021
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 2, 2021
}
// make sure the resource hasn't already been added to the store
if r.resource != nil || r.cleanupFuncs != nil {
if r.wasPut() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this code would benefit from

Suggested change
if r.wasPut() {
if ok && r.wasPut() {

Or something similar (as there's no need to check wasPut if we just created a new empty resource.

@codecov
Copy link

codecov bot commented Feb 2, 2021

Codecov Report

Merging #4530 (584f175) into master (f39e3d0) will increase coverage by 0.18%.
The diff coverage is 87.50%.

@@            Coverage Diff             @@
##           master    #4530      +/-   ##
==========================================
+ Coverage   40.21%   40.39%   +0.18%     
==========================================
  Files         115      115              
  Lines        9360     9374      +14     
==========================================
+ Hits         3764     3787      +23     
+ Misses       5173     5163      -10     
- Partials      423      424       +1     

@kolyshkin
Copy link
Collaborator

Nit: looks like WatcherForResource doc needs fixing, too. Currently it says

// WatcherForResource looks up a Resource by name, and gives it a watcher if it's found.

but in fact it gives a resource a watcher even if the lookup result is negative (by creating an uninitialized resource).

@haircommander
Copy link
Member Author

Nit: looks like WatcherForResource doc needs fixing, too. Currently it says

// WatcherForResource looks up a Resource by name, and gives it a watcher if it's found.

but in fact it gives a resource a watcher even if the lookup result is negative (by creating an uninitialized resource).

fixed!

@kolyshkin
Copy link
Collaborator

I would also reorder commits to put the fix before the test -- otherwise if someone uses git-bisect, they find that the test commit breaks things.

Overall LGTM except a few nits above.

@haircommander haircommander force-pushed the resourcestore-fixes branch 2 times, most recently from 3b101f4 to c58c4a6 Compare February 2, 2021 18:05
Copy link
Collaborator

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@QiWang19 QiWang19 left a comment

Choose a reason for hiding this comment

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

LGTM

@mrunalp
Copy link
Member

mrunalp commented Feb 2, 2021

/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels Feb 2, 2021
Copy link
Member

@saschagrunert saschagrunert 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-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, kolyshkin, saschagrunert

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

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


func (rc *ResourceStore) Close() {
rc.closeChan <- struct{}{}
}
Copy link
Member

Choose a reason for hiding this comment

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

should it also do close(rc.closeChan)?

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, it should actually only close methinks, as the receiever will still get a value out of it and know it's time to return

@haircommander haircommander force-pushed the resourcestore-fixes branch 2 times, most recently from c785146 to 7c07f59 Compare February 3, 2021 16:49
@haircommander
Copy link
Member Author

/retest

before, it was possible to segfault when a WatcherForResource was called followed by a Get
as we didn't check that the resource was actually put. Fix this

Signed-off-by: Peter Hunt <[email protected]>
We need to specifically register "Describe" functions,
but ginkgo doesn't allow us to register multiple ones.

Wrap different functionality in different Contexts so they all run.

Signed-off-by: Peter Hunt <[email protected]>
@haircommander haircommander force-pushed the resourcestore-fixes branch 2 times, most recently from 69ddaef to f307f68 Compare February 5, 2021 19:51
@haircommander
Copy link
Member Author

/retest

@fidencio
Copy link
Contributor

LGTM, and it does address all the comments raised, based on that ...
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 15, 2021
@haircommander
Copy link
Member Author

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 15, 2021

@haircommander: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-agnostic 584f175 link /test e2e-agnostic
ci/prow/e2e-gcp 584f175 link /test e2e-gcp

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@haircommander
Copy link
Member Author

/test integration_crun

@openshift-merge-robot openshift-merge-robot merged commit 7ca35f0 into cri-o:master Feb 15, 2021
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.

9 participants