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: migrate goroutine leak tests to goleak #27405

Merged
merged 3 commits into from
Aug 20, 2021

Conversation

tisonkun
Copy link
Contributor

Signed-off-by: tison wander4096@gmail.com

What problem does this PR solve?

Issue Number: close #27404

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 19, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • mmyj
  • xhebox

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 19, 2021
Signed-off-by: tison <wander4096@gmail.com>
@@ -8569,7 +8569,7 @@ func (s testSerialSuite) assertTemporaryTableNoNetwork(c *C, temporaryTableType
// With that failpoint, all requests to the TiKV is discard.
rs, err := tk1.Exec("select * from normal")
c.Assert(err, IsNil)
blocked := make(chan struct{})
blocked := make(chan struct{}, 1)
Copy link
Contributor Author

@tisonkun tisonkun Aug 19, 2021

Choose a reason for hiding this comment

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

It should be a buffer channel to unblock L8576, otherwise the anon goroutine blocked and leaks.

@@ -60,6 +60,11 @@ func (s *testTableSampleSuite) SetUpSuite(c *C) {
s.domain = d
}

func (s *testTableSampleSuite) TearDownSuite(c *C) {
s.domain.Close()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

do not close domain and store generates 30+ goroutine leaks

@github-actions github-actions bot added the sig/execution SIG execution label Aug 19, 2021
@tisonkun
Copy link
Contributor Author

/run-check_dev_2

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 20, 2021
opts := []goleak.Option{
goleak.IgnoreTopFunction("go.etcd.io/etcd/pkg/logutil.(*MergeLogger).outputLoop"),
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

but still I don't know where this function comes from.

Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC, outputLoop comes from the etcd client. I don't know where lumberjack is. You may try go mod graph.
`

Copy link
Contributor Author

@tisonkun tisonkun Aug 20, 2021

Choose a reason for hiding this comment

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

@xhebox I found it comes from pingcap/log

func initFileLog(cfg *FileLogConfig) (*lumberjack.Logger, error) {
  return &lumberjack.Logger
}

millRun seems like a daemon goroutine that range on millCh which is never closed.

func (l *Logger) millRun() {
	for _ = range l.millCh {
		// what am I going to do, log this?
		_ = l.millRunOnce()
	}
}

Copy link
Member

Choose a reason for hiding this comment

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

natefinch/lumberjack#56, It's a goroutine leak bug.

Copy link
Member

@mmyj mmyj left a comment

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 20, 2021
@mmyj
Copy link
Member

mmyj commented Aug 20, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: bb6bc87

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 20, 2021
@ti-chi-bot
Copy link
Member

@tisonkun: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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.

@tisonkun
Copy link
Contributor Author

/run-check_dev_2

1 similar comment
@tisonkun
Copy link
Contributor Author

/run-check_dev_2

@tisonkun tisonkun deleted the issue-27404 branch March 4, 2022 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. sig/execution SIG execution size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

migrate goroutine leak tests to goleak for executor
4 participants