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

threadpool: fix semaphore deadlock #795

Merged
merged 1 commit into from Dec 12, 2018
Merged

threadpool: fix semaphore deadlock #795

merged 1 commit into from Dec 12, 2018

Conversation

ghost
Copy link

@ghost ghost commented Dec 12, 2018

Motivation

This is a hotfix for #726. The semaphore used for allocating permits to call blocking() could run into a deadlock, as explained in this comment.

Solution

Call consume_blocking_allocation() when running the task rather than before running the task.

@carllerche
Copy link
Member

/cc @sfackler Are you able to test this patch to see if it resolves the issue you have been seeing?

@carllerche
Copy link
Member

@stjepang the change looks good to me. I'm hoping to get some confirmation that it fixed the bug before merging.

@sfackler
Copy link
Contributor

I'm probably not going to be able to test this, unfortunately. :( Certainly not before the new year.

@carllerche
Copy link
Member

Ok, we can merge & ship then... we'll test it live!

@carllerche carllerche merged commit 6aa990e into tokio-rs:master Dec 12, 2018
@carllerche
Copy link
Member

Thanks for implementing the fix @stjepang

@ghost ghost deleted the fix-semaphore-deadlock branch December 12, 2018 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants