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

sink/mysql: adjust producer/consumer exit sequence to avoid goroutine leak #1929

Merged
merged 6 commits into from
Jun 5, 2021

Conversation

amyangfei
Copy link
Contributor

@amyangfei amyangfei commented Jun 3, 2021

What problem does this PR solve?

Fix a goroutine leak bug, where the sink worker has exited, but more txns are sent to txn channel of sink worker.
And the producer will wait for the txn to be consumed forever.

What is changed and how it works?

Add a cleanup mechanism for sink worker.

  1. producer(sink.flushRowChangedEvents goroutine) of txnCh exits
  2. goroutine in 1 sends notification to closedCh of each sink worker
  3. each sink worker receives the notification from closedCh and mark FinishWg as Done

Check List

Tests

  • Unit test
  • Integration test

Release note

  • Fix a bug that some MySQL connection could leak after MySQL sink meets error and pauses.

@amyangfei amyangfei added component/sink Sink component. needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. labels Jun 3, 2021
@amyangfei amyangfei added this to the v5.0.3 milestone Jun 3, 2021
@amyangfei amyangfei changed the title sink/mysql: adjust producer/consumer exit sequence to avoid goroutine… sink/mysql: adjust producer/consumer exit sequence to avoid goroutine leak Jun 3, 2021
@ti-chi-bot ti-chi-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 3, 2021
@amyangfei
Copy link
Contributor Author

/run-all-tests

@amyangfei
Copy link
Contributor Author

/run-all-tests

@amyangfei
Copy link
Contributor Author

/run-unit-tests

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 4, 2021
@amyangfei amyangfei modified the milestones: v5.0.3, v5.1.0 Jun 4, 2021
@amyangfei
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • leoppro
  • liuzix

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 status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 4, 2021
@zier-one
Copy link
Contributor

zier-one commented Jun 4, 2021

/run-all-tests

@zier-one
Copy link
Contributor

zier-one commented Jun 4, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 32673df

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 4, 2021
@codecov-commenter
Copy link

Codecov Report

Merging #1929 (49ffd92) into master (a1067a0) will increase coverage by 0.4297%.
The diff coverage is 67.3134%.

@@               Coverage Diff                @@
##             master      #1929        +/-   ##
================================================
+ Coverage   53.8503%   54.2801%   +0.4297%     
================================================
  Files           155        163         +8     
  Lines         16479      17336       +857     
================================================
+ Hits           8874       9410       +536     
- Misses         6655       6918       +263     
- Partials        950       1008        +58     

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #1945.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #1946.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/sink Sink component. needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. size/L Denotes a PR that changes 100-499 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.

5 participants