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

FFI: fix deadlock in hyper_executor::poll_next #3370

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Oct 23, 2023

poll_next locks the driver, and also calls drain_queue while holding that lock. Since drain_queue locks the driver too, that results in a deadlock.

To fix, unlock the driver before calling drain_queue.

Fixes #3369.

@seanmonstar
Copy link
Member

The fix looks great, thanks! Seems CI is grumpy about a missing comma, of course.

poll_next locks the driver, and also calls drain_queue while holding
that lock. Since drain_queue locks the driver too, that results in a
deadlock.

To fix, unlock the driver before calling drain_queue.
src/ffi/task.rs Show resolved Hide resolved
@seanmonstar seanmonstar merged commit 0c7d03e into hyperium:master Oct 23, 2023
19 checks passed
@jsha jsha deleted the unlock-deadlock branch October 23, 2023 19:59
0xE282B0 pushed a commit to 0xE282B0/hyper that referenced this pull request Jan 12, 2024
poll_next locks the driver, and also calls drain_queue while holding
that lock. Since drain_queue locks the driver too, that results in a
deadlock.

To fix, unlock the driver before calling drain_queue.

Closes hyperium#3369
0xE282B0 pushed a commit to 0xE282B0/hyper that referenced this pull request Jan 16, 2024
poll_next locks the driver, and also calls drain_queue while holding
that lock. Since drain_queue locks the driver too, that results in a
deadlock.

To fix, unlock the driver before calling drain_queue.

Closes hyperium#3369

Signed-off-by: Sven Pfennig <s.pfennig@reply.de>
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.

C API deadlock in hyper_executor::poll_next
3 participants