-
Notifications
You must be signed in to change notification settings - Fork 111
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
Fix panic in speculative execution #1086
Fix panic in speculative execution #1086
Conversation
|
Oh, it looks like passing only completed futures to select! without complete branch causes panic instead of deadlock - in that case it may be possible to write a test. |
This commit fixes a panic in `scylla::transport::speculative_execution::execute`. It is possible for all speculative fibers to finish without returning from the function. In that situation `select!` macro will panic because all futures passed to it are completed. Consider the scenario where all executions return BrokenConnection: we will only assign to last_error and never return. There are more ways that this bug can happen, but this is the simplest one to explain and reproduce. This commit fixes the bug by simplifying the logic inside the function. The new logic always checks if the resolved task is the last one, and if so it returns, so it's not possible for executions to be exhausted when calling `select!`.
f44942d
to
a5f84c3
Compare
Good that they designed |
a5f84c3
to
e0607c8
Compare
I renamed the test, because the bug is a panic not a deadlock. PR is ready for review. |
e0607c8
to
630f8c3
Compare
Addressed review comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome that you noticed the bug! Congrats!
This PR fixes linked bug by simplifying the logic inside the function.
The new logic always checks if the resolved task is the last one, and if so it returns, so it's not possible for the tasks to be exhausted without finishing the
select!
.This PR also adds regression test for the issue. I verified that the test actually panics without the fix.
Fixes: #1085
Pre-review checklist
I have provided docstrings for the public items that I want to introduce.I have adjusted the documentation in./docs/source/
.I added appropriateFixes:
annotations to PR description.