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

Fix panic: "nil pointer dereference" #2011

Merged
merged 1 commit into from
Jun 19, 2022

Conversation

nunnatsa
Copy link
Collaborator

@nunnatsa nunnatsa commented Jun 19, 2022

The software craches when updating a metric resource, because then we're
trying to send a nil HyperConverged pointer to a function as an interface.
The function does check for nil, but this is not working, because
interface(nil) != nil.

This PR fixes the bug by not sending the nil interface but an actual
nil, and also changes the check to use reflection in order to make sure
that the function parameter is nil.

Signed-off-by: Nahshon Unna-Tsameret nunnatsa@redhat.com

Reviewer Checklist

Reviewers are supposed to review the PR for every aspect below one by one. To check an item means the PR is either "OK" or "Not Applicable" in terms of that item. All items are supposed to be checked before merging a PR.

  • PR Message
  • Commit Messages
  • How to test
  • Unit Tests
  • Functional Tests
  • User Documentation
  • Developer Documentation
  • Upgrade Scenario
  • Uninstallation Scenario
  • Backward Compatibility
  • Troubleshooting Friendly

Release note:

Fix sw crash 

The software craches when updating a metric resource, because then we're
trying to send the HyperConverged pointer to a function as an interface.
The function does check for nil, but this is not working, because
interface(nil) != nil.

This PR fixes the bug by not sending the nil interface but an actual
nil, and also changes the check to use reflection in order to make sure
that the function parameter is nil.

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Jun 19, 2022
@sonarcloud
Copy link

sonarcloud bot commented Jun 19, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 2523891562

  • 2 of 2 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 84.991%

Files with Coverage Reduction New Missed Lines %
controllers/operands/operandHandler.go 1 84.85%
Totals Coverage Status
Change from base Build 2515718517: -0.02%
Covered Lines: 4451
Relevant Lines: 5237

💛 - Coveralls

@nunnatsa
Copy link
Collaborator Author

/override coverage/coveralls

@kubevirt-bot
Copy link
Contributor

@nunnatsa: Overrode contexts on behalf of nunnatsa: coverage/coveralls

In response to this:

/override coverage/coveralls

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.

@nunnatsa nunnatsa changed the title Fix "nil pointer exception" Fix panic: "nil pointer dereference" Jun 19, 2022
@hco-bot
Copy link
Collaborator

hco-bot commented Jun 19, 2022

okd-hco-e2e-upgrade-index-aws lane succeeded.
/override ci/prow/okd-hco-e2e-upgrade-index-gcp

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/okd-hco-e2e-upgrade-index-gcp

In response to this:

okd-hco-e2e-upgrade-index-aws lane succeeded.
/override ci/prow/okd-hco-e2e-upgrade-index-gcp

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-ci
Copy link

openshift-ci bot commented Jun 19, 2022

@nunnatsa: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-hco-e2e-upgrade-index-gcp c12a9af link true /test okd-hco-e2e-upgrade-index-gcp
ci/prow/hco-e2e-image-index-gcp c12a9af link true /test hco-e2e-image-index-gcp

Full PR test history. Your PR dashboard.

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.

@hco-bot
Copy link
Collaborator

hco-bot commented Jun 19, 2022

hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-gcp

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-gcp

In response to this:

hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-gcp

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.

@machadovilaca
Copy link
Member

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 19, 2022
Copy link
Collaborator

@orenc1 orenc1 left a comment

Choose a reason for hiding this comment

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

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: orenc1

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 19, 2022
@kubevirt-bot kubevirt-bot merged commit 43f0a56 into kubevirt:main Jun 19, 2022
@nunnatsa nunnatsa deleted the fix_nil_pointer_exception branch September 28, 2022 05:24
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. 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. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants