-
Notifications
You must be signed in to change notification settings - Fork 6k
br: fix go leak when nothing to restore #58626
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
Conversation
Hi @Tristan1900. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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-sigs/prow repository. |
|
||
if len(files) == 0 { | ||
log.Info("no files, empty databases and tables are restored") | ||
summary.SetSuccessStatus(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should go though to the end of method and get set anyway
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #58626 +/- ##
================================================
+ Coverage 72.9965% 74.6101% +1.6135%
================================================
Files 1683 1699 +16
Lines 465963 466064 +101
================================================
+ Hits 340137 347731 +7594
+ Misses 104867 96644 -8223
- Partials 20959 21689 +730
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/assign @3pointer |
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
// even nothing to restore, we show a success message since there is no failure. | ||
summary.SetSuccessStatus(true) | ||
return nil | ||
// go through rest of the process, need to clean up some resources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's strange to add comments at the rear of a code block.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: RidRisR The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
close as fixed as part of the change in #57394 |
What problem does this PR solve?
Issue Number: close #58624
Problem Summary:
What changed and how does it work?
Remove the early return, found 2 issues related to it, so better go through the entire restore process to avoid future surprises.
GoSwitchToImportMode
not inherit from the main ctx, thus when main ctx cancelled, the go routine won't end, and the manual cleanup logic wasn't called when restoring an empty backup, leading to a go routine leak found in int testNewSnapFileImporter
and store it into a closurerc.getRestorerFn
, early return didn't call the closure so couldn't free up the connection, causing another go leak.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.