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

util: fix a resource leak bug about mpsc::batch (#5566) #5567

Merged
merged 2 commits into from Sep 30, 2019

Conversation

@sre-bot
Copy link
Collaborator

commented Sep 30, 2019

cherry-pick #5566 to release-3.0


When batch::Sender is dropped, it needs to drop the internal
crossbeam::Sender before notify the receiver respectively,
otherwise the receiver maybe can't know it forever if the receiver
is running in an Executor as a future.

Signed-off-by: qupeng qupeng@pingcap.com

What have you changed?

Fix a potential resourse leak bug.

What is the type of the changes?

Bugfix.

How is the PR tested?

Please select the tests that you ran to verify your changes:
Unit test.

Previously we only test the channel in multi threads, so the bug is very hard to produce. Now we add a case which polls the receiver in Sender::drop, so it can be produced 100%.

Relative issues

Close #5563.
In the issue file descriptors leak because they are associated with some GrpcCalls. With this bug some resources can't be released after the Sender is dropped, and they could never be released. When GrpcCalls leak, their internal sockets can't be closed.

hicqu added 2 commits Sep 29, 2019
When `batch::Sender` is dropped, it needs to drop the shared states
before notify the receiver respectively, otherwise the receiver maybe
can't know it forever.

Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
@sre-bot

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 30, 2019

/run-all-tests

Copy link
Member

left a comment

LGTM

Copy link
Member

left a comment

LGTM

@5kbpers 5kbpers added the S: CanMerge label Sep 30, 2019
@sre-bot

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 30, 2019

/run-all-tests

@sre-bot sre-bot merged commit d4b126a into tikv:release-3.0 Sep 30, 2019
6 checks passed
6 checks passed
DCO All commits are signed off!
Details
idc-jenkins-ci-tikv/integration-common-test Jenkins job succeeded.
Details
idc-jenkins-ci-tikv/integration-compatibility-test Jenkins job succeeded.
Details
idc-jenkins-ci-tikv/integration-cop-push-down-test Jenkins job succeeded.
Details
idc-jenkins-ci-tikv/integration-ddl-test Jenkins job succeeded.
Details
idc-jenkins-ci/test Jenkins job succeeded.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.