Skip to content

sessionctx: fix a deadlock when set tidb_restricted_read_only = true#55407

Merged
ti-chi-bot[bot] merged 3 commits into
pingcap:masterfrom
Defined2014:fix-55373
Aug 14, 2024
Merged

sessionctx: fix a deadlock when set tidb_restricted_read_only = true#55407
ti-chi-bot[bot] merged 3 commits into
pingcap:masterfrom
Defined2014:fix-55373

Conversation

@Defined2014
Copy link
Copy Markdown
Contributor

@Defined2014 Defined2014 commented Aug 14, 2024

What problem does this PR solve?

Issue Number: close #55373, close #53822,

Problem Summary: follow #40283

What changed and how does it work?

Check List

Tests

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

run shell below, reach more than 10000

count=0
while true; do
mysql -h 127.0.0.1 -P 4000 -u root -e "set global tidb_restricted_read_only = 1;set global tidb_restricted_read_only = 0;";
count=$((count+1))
echo "$count"
done
  • 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 release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-triage-completed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 14, 2024
@tiprow
Copy link
Copy Markdown

tiprow Bot commented Aug 14, 2024

Hi @Defined2014. 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.

Details

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.

@ti-chi-bot ti-chi-bot Bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. and removed do-not-merge/needs-triage-completed labels Aug 14, 2024
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 14, 2024

Codecov Report

❌ Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.1637%. Comparing base (bab3667) to head (6f1fc8c).
⚠️ Report is 2226 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #55407        +/-   ##
================================================
+ Coverage   74.9822%   75.1637%   +0.1815%     
================================================
  Files          1576       1577         +1     
  Lines        365580     443312     +77732     
================================================
+ Hits         274120     333210     +59090     
- Misses        71731      90020     +18289     
- Partials      19729      20082       +353     
Flag Coverage Δ
integration 49.7214% <40.0000%> (?)
unit 72.8833% <40.0000%> (-1.7523%) ⬇️

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

Components Coverage Δ
dumpling ∅ <ø> (∅)
parser ∅ <ø> (∅)
br 53.3257% <ø> (+4.6624%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Defined2014
Copy link
Copy Markdown
Contributor Author

/retest

@tiprow
Copy link
Copy Markdown

tiprow Bot commented Aug 14, 2024

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

Details

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.

@Defined2014 Defined2014 requested a review from xhebox August 14, 2024 07:59
@ti-chi-bot ti-chi-bot Bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 14, 2024
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Aug 14, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-14 06:54:51.915812813 +0000 UTC m=+337376.619282451: ☑️ agreed by hawkingrei.
  • 2024-08-14 08:23:42.352758852 +0000 UTC m=+342707.056228508: ☑️ agreed by CbcWestwolf.

@tiprow
Copy link
Copy Markdown

tiprow Bot commented Aug 14, 2024

@Defined2014: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
fast_test_tiprow 6f1fc8c link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

@easonn7
Copy link
Copy Markdown

easonn7 commented Aug 14, 2024

/approve

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Aug 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CbcWestwolf, easonn7, hawkingrei

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 added the approved label Aug 14, 2024
@Defined2014 Defined2014 changed the title sessionctx: fix potential deadlock sessionctx: fix potential deadlock in setGlobalVars Aug 14, 2024
@Defined2014 Defined2014 changed the title sessionctx: fix potential deadlock in setGlobalVars sessionctx: fix a deadlock in setGlobalVars Aug 14, 2024
@Defined2014 Defined2014 changed the title sessionctx: fix a deadlock in setGlobalVars sessionctx: fix a deadlock when set tidb_restricted_read_only Aug 14, 2024
@Defined2014 Defined2014 changed the title sessionctx: fix a deadlock when set tidb_restricted_read_only sessionctx: fix a deadlock when set tidb_restricted_read_only = true Aug 14, 2024
@Defined2014
Copy link
Copy Markdown
Contributor Author

/retest

@tiprow
Copy link
Copy Markdown

tiprow Bot commented Aug 14, 2024

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

Details

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.

@Defined2014
Copy link
Copy Markdown
Contributor Author

/retest

@tiprow
Copy link
Copy Markdown

tiprow Bot commented Aug 14, 2024

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

Details

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.

@Defined2014
Copy link
Copy Markdown
Contributor Author

/retest

@tiprow
Copy link
Copy Markdown

tiprow Bot commented Aug 14, 2024

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

Details

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.

@ti-chi-bot ti-chi-bot Bot merged commit 1b172b6 into pingcap:master Aug 14, 2024
@Defined2014 Defined2014 deleted the fix-55373 branch August 14, 2024 13:28
@YangKeao YangKeao added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels Jul 31, 2025
@ti-chi-bot
Copy link
Copy Markdown
Member

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

@ti-chi-bot
Copy link
Copy Markdown
Member

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

@ti-chi-bot
Copy link
Copy Markdown
Member

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

@ti-chi-bot
Copy link
Copy Markdown
Member

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

@ti-chi-bot
Copy link
Copy Markdown
Member

In response to a cherrypick label: failed to apply #55407 on top of branch "release-8.5":

failed to git commit: exit status 1

@YangKeao
Copy link
Copy Markdown
Member

This bug may happen when setting any global variables after setting tidb_restricted_read_only. Therefore, I'll cherry-pick it back to all LTS versions.

@YangKeao
Copy link
Copy Markdown
Member

/cherry-pick release-6.5-20241112-v6.5.11

@ti-chi-bot
Copy link
Copy Markdown
Member

@YangKeao: new pull request created to branch release-6.5-20241112-v6.5.11: #63515.

Details

In response to this:

/cherry-pick release-6.5-20241112-v6.5.11

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.

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-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

6 participants