pd icon indicating copy to clipboard operation
pd copied to clipboard

client: signal RG GC goroutines to exit properly

Open yzhan1 opened this issue 3 months ago • 7 comments

What problem does this PR solve?

Issue Number: Close #9745

What is changed and how does it work?

Adds a new cancel channel to signal GC goroutines when they can be stopped, to prevent goroutine leaks on client side.

client: signal RG GC goroutines to exit properly

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below) Manually tested using TiDB build with the same traffic which generates 600 extra goroutines stuck in handleTokenBucketUpdateEvent. After the fix only 1 goroutine in handleTokenBucketUpdateEvent.
  • No code

Code changes

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

Release note

None.

yzhan1 avatar Sep 17 '25 04:09 yzhan1

Hi @yzhan1. Thanks for your PR.

I'm waiting for a tikv 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-sigs/prow repository.

ti-chi-bot[bot] avatar Sep 17 '25 04:09 ti-chi-bot[bot]

@okJiang @JmPotato updated based on comments. PTAL, thanks!

yzhan1 avatar Sep 19 '25 05:09 yzhan1

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: okJiang Once this PR has been reviewed and has the lgtm label, please assign disksing for approval. For more information see the Code Review Process. Please ensure that each of them provides their approval before proceeding.

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[bot] avatar Sep 25 '25 02:09 ti-chi-bot[bot]

[LGTM Timeline notifier]

Timeline:

  • 2025-09-25 02:53:07.960048019 +0000 UTC m=+497998.030541694: :ballot_box_with_check: agreed by okJiang.

ti-chi-bot[bot] avatar Sep 25 '25 02:09 ti-chi-bot[bot]

/retest

okJiang avatar Sep 25 '25 02:09 okJiang

Codecov Report

:x: Patch coverage is 66.66667% with 6 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 76.90%. Comparing base (53b1fbf) to head (5754471). :warning: Report is 26 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9749      +/-   ##
==========================================
+ Coverage   76.84%   76.90%   +0.05%     
==========================================
  Files         484      486       +2     
  Lines       77142    77411     +269     
==========================================
+ Hits        59281    59534     +253     
- Misses      14258    14261       +3     
- Partials     3603     3616      +13     
Flag Coverage Δ
unittests 76.90% <66.66%> (+0.05%) :arrow_up:

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

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Sep 25 '25 03:09 codecov[bot]

/cc @JmPotato @bufferflies

okJiang avatar Oct 31 '25 06:10 okJiang