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

sync: fix mpsc bug related to closing the channel #3215

Merged
merged 2 commits into from Dec 7, 2020

Conversation

carllerche
Copy link
Member

@Darksonn Darksonn added A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-sync Module: tokio/sync T-v0.2.x Topic: tokio 0.2.x labels Dec 5, 2020
When closing a channel, it is possible to get into an invalid state when
outstanding permits release capacity back to the channel.
@carllerche carllerche marked this pull request as ready for review December 7, 2020 18:25
@@ -512,3 +512,27 @@ fn ready_close_cancel_bounded() {

assert!(recv.is_woken());
}

#[tokio::test]
async fn permit_available_not_acquired_close() {
Copy link
Member

Choose a reason for hiding this comment

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

nit: it might be nice to have a comment here explaining what this test reproduces?

carllerche added a commit that referenced this pull request Dec 7, 2020
Forward ports the test included in #3215. The mpsc sempahore has been
replaced in 0.3 and does not include the bug being fixed.
@carllerche carllerche merged commit 3d17488 into v0.2.x Dec 7, 2020
@carllerche carllerche deleted the fix-0.2-chan-bug branch December 7, 2020 19:04
carllerche added a commit that referenced this pull request Dec 7, 2020
Forward ports the test included in #3215. The mpsc sempahore has been
replaced in 0.3 and does not include the bug being fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-sync Module: tokio/sync T-v0.2.x Topic: tokio 0.2.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants