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

executor: fix tidb crash when calling Close and Finish #54390

Merged
merged 6 commits into from
Jul 3, 2024

Conversation

wshwsh12
Copy link
Contributor

@wshwsh12 wshwsh12 commented Jul 2, 2024

What problem does this PR solve?

Issue Number: close #54335

Problem Summary: ref #52882

What changed and how does it work?

  1. Move the finishLock to tidbResultSet to protect Close() and Finish().
  2. Clear SQLKiller.Finish() when writeResultSet finished.
Bug Analyze:
interface:resultSet.ResultSet           -> {RecordSet}       -> {RecordSet}
struct   :tidbResultSet                 -> execStmtResult   -> recordSet

calling chain:

main goroutine: tidbResultSet.Close  ->  execStmtResultSet.Close  ->  execStmtResultSet.Finish() 
                                                                 ->  recordSet.Close                -> recordSet.Finish()
                                                                                                    -> recordSet.CleanWork
                                                                 ->  execStmtResultSet.CleanWork
                                     -> tidbResultSet.CleanWork(race)


kill goroutine: tidbResultSet.Finish(race) ->  execStmtResultSet.Finish ->  recordSet.Finish

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 2, 2024
Copy link

tiprow bot commented Jul 2, 2024

Hi @wshwsh12. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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.

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 92.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 55.7637%. Comparing base (e985478) to head (56df574).
Report is 14 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54390         +/-   ##
=================================================
- Coverage   72.8299%   55.7637%   -17.0662%     
=================================================
  Files          1531       1654        +123     
  Lines        435995     612706     +176711     
=================================================
+ Hits         317535     341668      +24133     
- Misses        98818     247488     +148670     
- Partials      19642      23550       +3908     
Flag Coverage Δ
integration 22.7289% <25.0000%> (?)
unit 71.8048% <92.5000%> (-0.0191%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9656% <ø> (ø)
parser ∅ <ø> (∅)
br 52.6639% <ø> (+6.5274%) ⬆️

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/needs-tests-checked labels Jul 3, 2024
@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Jul 3, 2024

/retest

Copy link

tiprow bot commented Jul 3, 2024

@wshwsh12: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@wshwsh12 wshwsh12 force-pushed the fix-killquery-panic branch from d6b5cb1 to 56df574 Compare July 3, 2024 07:50
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 3, 2024
Copy link

ti-chi-bot bot commented Jul 3, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guo-shaoge, XuHuaiyu

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:
  • OWNERS [XuHuaiyu,guo-shaoge]

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 added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 3, 2024
Copy link

ti-chi-bot bot commented Jul 3, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-03 08:38:29.031790791 +0000 UTC m=+1400035.517279623: ☑️ agreed by guo-shaoge.
  • 2024-07-03 08:56:53.340944316 +0000 UTC m=+1401139.826433147: ☑️ agreed by XuHuaiyu.

@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Jul 3, 2024

/retest

Copy link

tiprow bot commented Jul 3, 2024

@wshwsh12: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@wshwsh12 wshwsh12 merged commit 467eacc into pingcap:master Jul 3, 2024
23 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.2: #54416.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-8.2 release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tidb panic after injection network partition between two AZ
4 participants