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: close mysql statement and rows resources when sql exec end #1720

Merged

Conversation

chenwenjun-github
Copy link
Contributor

What this PR does / why we need it:
close mysql statement and rows resources when sql exec end, reslove mysql statement leak

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1719

Checklist:

  • Docs included if any changes are user facing

@google-cla
Copy link

google-cla bot commented Oct 22, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@aws-kf-ci-bot
Copy link
Contributor

Hi @chenwenjun-github. Thanks for your PR.

I'm waiting for a kubeflow 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.

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.

@chenwenjun-github
Copy link
Contributor Author

@googlebot I fixed it.

@google-cla
Copy link

google-cla bot commented Oct 22, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@johnugeorge
Copy link
Member

/ok-to-test

Copy link
Member

@gaocegege gaocegege left a comment

Choose a reason for hiding this comment

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

LGTM

/assign @andreyvelich

@johnugeorge
Copy link
Member

@chenwenjun-github Thanks for creating this.
Can you fix CLA issue? We can merge this when CI passes

@coveralls
Copy link

coveralls commented Oct 22, 2021

Coverage Status

Coverage increased (+0.2%) to 73.723% when pulling 6fe941a on chenwenjun-github:close_mysql_stmt into 195db29 on kubeflow:master.

@@ -132,6 +132,9 @@ func (d *dbConn) RegisterObservationLog(trialName string, observationLog *v1beta
return fmt.Errorf("Pepare SQL statement failed: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for the fix @chenwenjun-github ! Could you please also correct the typo here? (Prepare)
Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

Thank you for debugging this @chenwenjun-github!
I hope this will resolve issue: #1651.

@@ -179,6 +182,8 @@ func (d *dbConn) GetObservationLog(trialName string, metricName string, startTim
result := &v1beta1.ObservationLog{
MetricLogs: []*v1beta1.MetricLog{},
}
// Close the rows
defer rows.Close()
Copy link
Member

Choose a reason for hiding this comment

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

Please can you move this right after the error check (line number 182), similar to stmt.Close().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chenwenjun-github
To complete the pull request process, please ask for approval from andreyvelich after the PR has been reviewed.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-cla
Copy link

google-cla bot commented Oct 26, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@chenwenjun-github
Copy link
Contributor Author

@googlebot I fixed it.

@chenwenjun-github
Copy link
Contributor Author

@chenwenjun-github Thanks for creating this. Can you fix CLA issue? We can merge this when CI passes

done

@andreyvelich
Copy link
Member

Thank you for updating this @chenwenjun-github!
/lgtm
/assign @gaocegege @johnugeorge

@johnugeorge
Copy link
Member

/approve

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chenwenjun-github, johnugeorge

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

@google-oss-robot google-oss-robot merged commit bfe4527 into kubeflow:master Nov 2, 2021
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.

katib-db-manager mysql statement leak
9 participants