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

*: fix goleak in the client-go #49046

Merged
merged 2 commits into from
Nov 30, 2023
Merged

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented Nov 30, 2023

What problem does this PR solve?

Issue Number: close #49038

Problem Summary:

What changed and how does it work?

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

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@hawkingrei
Copy link
Member Author

/check-issue-triage-complete

Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Merging #49046 (50d1bd7) into master (f39e9bf) will increase coverage by 1.5245%.
Report is 5 commits behind head on master.
The diff coverage is n/a.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49046        +/-   ##
================================================
+ Coverage   70.9922%   72.5168%   +1.5245%     
================================================
  Files          1368       1391        +23     
  Lines        403975     410975      +7000     
================================================
+ Hits         286791     298026     +11235     
+ Misses        97214      94139      -3075     
+ Partials      19970      18810      -1160     
Flag Coverage Δ
integration 43.6902% <ø> (?)
unit 70.9922% <ø> (ø)

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

Components Coverage Δ
dumpling 53.9663% <ø> (ø)
parser ∅ <ø> (∅)
br 48.3541% <ø> (-4.6181%) ⬇️

@@ -80,7 +80,7 @@ func RunTestMain(m *testing.M) {
goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"),
goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"),
// backoff function will lead to sleep, so there is a high probability of goroutine leak while it's doing backoff.
goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.(*Config).createBackoffFn.newBackoffFn.func2"),
goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/config/retry.(*Config).createBackoffFn.newBackoffFn.func2"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could change all files,

./tests/realtikvtest/testkit.go:                goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./tests/realtikvtest/testkit.go:                goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.(*Config).createBackoffFn.newBackoffFn.func2"),
./docs/design/2021-04-26-lock-view.md:    * There are two types of deadlock errors internally: retryable or non-retryable. The transaction will internally retry on retryable deadlocks and won't report error to the client. Therefore, the user are typically more interested in the non-retryable deadlocks.
./br/pkg/lightning/backend/backend.go:  importMaxRetryTimes = 3 // tikv-importer has done retry internally. so we don't retry many times.
./pkg/sessiontxn/isolation/optimistic.go:// If the session is already in transaction, enable retry or internal SQL could retry.
./pkg/sessiontxn/isolation/optimistic.go:       // The internal transaction could always retry.
./pkg/store/copr/copr_test/main_test.go:                goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/nontransactionaltest/main_test.go:                goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/bootstraptest/main_test.go:               goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/test/vars/main_test.go:           goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/test/txn/main_test.go:            goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/test/variable/main_test.go:               goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/test/meta/main_test.go:           goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/test/privileges/main_test.go:             goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/test/common/main_test.go:         goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/test/main_test.go:                goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/clusteredindextest/main_test.go:          goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/schematest/main_test.go:          goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/temporarytabletest/main_test.go:          goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),
./pkg/session/main_test.go:             goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"),

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 30, 2023
Copy link
Contributor

@you06 you06 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Nov 30, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-11-30 08:36:18.326712802 +0000 UTC m=+1084606.991938990: ☑️ agreed by lance6716.
  • 2023-11-30 08:52:46.483461854 +0000 UTC m=+1085595.148688039: ☑️ agreed by you06.

Copy link

ti-chi-bot bot commented Nov 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, lance6716, you06

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 [Defined2014,lance6716,you06]

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 b016589 into pingcap:master Nov 30, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
4 participants