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

BUGFIX: Added cancel method to fix context leak #1917

Merged
merged 1 commit into from
Apr 6, 2024

Conversation

fazledyn-or
Copy link
Contributor

This PR fixes a context leak bug in your code.

Summary

While triaging your project, our bug fixing tool generated the following message-

In file: event.go, method context.WithTimeout is called where the returned cancel function is ignored. It is suggested that the returned cancel function shouldn't be ignored.

Details

In the line below, a context is created using the WithTimeout method, where the returned cancelFunc handler is ignored.

ctx, _ = context.WithTimeout(ctx, watchExpire)

I have introduced the cancel handler and deferred it so that once the method Run() completes execution, it can be safely cancelled.

Sponsorship and Support

This work is done by the security researchers from OpenRefactory and is supported by the Open Source Security Foundation (OpenSSF): Project Alpha-Omega. Alpha-Omega is a project partnering with open source software project maintainers to systematically find new, as-yet-undiscovered vulnerabilities in open source code - and get them fixed – to improve global software supply chain security.

The bug is found by running the Intelligent Code Repair (iCR) tool by OpenRefactory and then manually triaging the results.

Signed-off-by: fazledyn-or <ataf@openrefactory.com>
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fazledyn-or, yuchaoran2011

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

@yuchaoran2011
Copy link
Contributor

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Apr 6, 2024
@google-oss-prow google-oss-prow bot merged commit 14a39e6 into kubeflow:master Apr 6, 2024
2 checks passed
peter-mcclonski pushed a commit to TechnologyBrewery/spark-on-k8s-operator that referenced this pull request Apr 16, 2024
Signed-off-by: fazledyn-or <ataf@openrefactory.com>
Signed-off-by: Peter McClonski <mcclonski_peter@bah.com>
sigmarkarl pushed a commit to spotinst/spark-on-k8s-operator that referenced this pull request Aug 7, 2024
Signed-off-by: fazledyn-or <ataf@openrefactory.com>
jbhalodia-slack pushed a commit to jbhalodia-slack/spark-operator that referenced this pull request Oct 4, 2024
Signed-off-by: fazledyn-or <ataf@openrefactory.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants