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 potential goroutine leak when kill connection #13051

Merged
merged 5 commits into from Nov 1, 2019

Conversation

SunRunAway
Copy link
Contributor

@SunRunAway SunRunAway commented Oct 31, 2019

What problem does this PR solve?

Fix #13050

What is changed and how it works?

Check List

Tests

  • Unit test (covered by TestShutDown)

Code changes

  • None

Side effects

  • None

Related changes

  • None

Release note

  • None

@SunRunAway SunRunAway changed the title fix potential goroutine leak when kill connection server: fix potential goroutine leak when kill connection Oct 31, 2019
if err != nil {
metrics.ExecuteErrorCounter.WithLabelValues(metrics.ExecuteErrorToLabel(err)).Inc()
return err
}
status := atomic.LoadInt32(&cc.status)
if rs != nil && (status == connStatusShutdown || status == connStatusWaitShutdown) {
killConn(cc)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here it need not to killConn again

Copy link
Collaborator

@lysu lysu left a comment

Choose a reason for hiding this comment

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

LGTM

maybe we can add a failpoint in conn.go:1153 to help TiBug regression test this @zyguan

@SunRunAway
Copy link
Contributor Author

@lysu I've updated test, now it can be covered by TestShutDown.

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added the status/LGT2 Indicates that a PR has LGTM 2. label Nov 1, 2019
@codecov
Copy link

codecov bot commented Nov 1, 2019

Codecov Report

Merging #13051 into master will increase coverage by 0.0111%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##             master     #13051        +/-   ##
================================================
+ Coverage   80.0413%   80.0524%   +0.0111%     
================================================
  Files           468        468                
  Lines        109852     109828        -24     
================================================
- Hits          87927      87920         -7     
+ Misses        15170      15161         -9     
+ Partials       6755       6747         -8

@SunRunAway SunRunAway added the status/can-merge Indicates a PR has been approved by a committer. label Nov 1, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

Your auto merge job has been accepted, waiting for 12997

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

@SunRunAway merge failed.

@SunRunAway
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

/run-all-tests

@sre-bot sre-bot merged commit 07eed7b into pingcap:master Nov 1, 2019
@SunRunAway SunRunAway deleted the conn branch November 1, 2019 08:18
@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

cherry pick to release-3.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

cherry pick to release-2.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

cherry pick to release-3.0 failed

SunRunAway added a commit to SunRunAway/tidb that referenced this pull request Nov 7, 2019
SunRunAway added a commit to SunRunAway/tidb that referenced this pull request Nov 7, 2019
SunRunAway added a commit to SunRunAway/tidb that referenced this pull request Nov 7, 2019
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/server status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

potential goroutine leak when kill connection
4 participants