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

server: fix memtracker leak with cursor (#44257) | tidb-test=pr/2135 #44825

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #44257

What problem does this PR solve?

Issue Number: close #44254

Problem Summary:

What is changed and how it works?

Detach the memTracker if the resultSet and err are both not empty. Consider the four situations:

  1. resultSet == nil && err == nil. It will be detached in the defer of handleNoDelay directly.
  2. resultSet != nil && err == nil. It will be detached when the resultSet is closed.
  3. resultSet == nil && err != nil. This PR fixes this situations It will be detached right before returning the error.
  4. resultSet != nil && err != nil. This PR fixes this situations It will be detached when the resultSet is closed.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Release note

Fix the issue that the `memTracker` is not cleared when facing an error while executing statement with cursor fetch.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-6.1-20230515-v6.1.6 labels Jun 20, 2023
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 20, 2023
@wshwsh12 wshwsh12 force-pushed the cherry-pick-44257-to-release-6.1-20230515-v6.1.6 branch from 78ccceb to 8f1296f Compare June 20, 2023 05:42
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 20, 2023
@wshwsh12 wshwsh12 force-pushed the cherry-pick-44257-to-release-6.1-20230515-v6.1.6 branch from 8f1296f to c7a69b4 Compare June 20, 2023 05:43
Copy link
Member

@YangKeao YangKeao left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 20, 2023

@YangKeao: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

LGTM

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.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 20, 2023

@XuHuaiyu: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

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.

@wshwsh12
Copy link
Contributor

/retest

@wshwsh12 wshwsh12 changed the title server: fix memtracker leak with cursor (#44257) server: fix memtracker leak with cursor (#44257) | tidb-test=pr/2135 Jun 20, 2023
@wshwsh12
Copy link
Contributor

/retest

@wshwsh12
Copy link
Contributor

/merge

@wshwsh12
Copy link
Contributor

/approve

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 20, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wshwsh12, XuHuaiyu, YangKeao

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

@ti-chi-bot ti-chi-bot bot merged commit 128bf15 into pingcap:release-6.1-20230515-v6.1.6 Jun 20, 2023
@wuhuizuo wuhuizuo deleted the cherry-pick-44257-to-release-6.1-20230515-v6.1.6 branch June 20, 2023 08:35
@YangKeao
Copy link
Member

/cherry-pick release-6.1

@ti-chi-bot
Copy link
Member Author

@YangKeao: new pull request created to branch release-6.1: #44988.

In response to this:

/cherry-pick release-6.1

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 ti-community-infra/tichi repository.

YangKeao pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/cherry-pick-for-release-6.1-20230515-v6.1.6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants