fix(tokio): futures::executor::block_on is not compatible with tokio - #26804
Merged
Conversation
* fix(tokio): futures::executor::block_on is not compatible with tokio futures::executor::block_on takes over the thread that calls it with a while loop expecting another thread or runtime to drive the contained future to completion. This doesn't work with tokio's runtime thread expectations where it expects to swap tasks off threads as it likes. While it doesn't always cause an issue with tokio, the futures block_on can stall the tokio runtime. The method tokio::task::block_in_place runs the contained closure in a blocking manner without blocking the runtime. Within it then, you can use Handle::current().block_on to enter an async context to execute futures correctly on tokio's runtime. These tokio versions are not compatible with the "current_thread" runtime option of tokio. This commit also includes the uri path when an authentical request to the server's http api fails. This is useful for understand the target of the unauthorized request. * fix: remove current thread tokio runtime type It is not compatible with our execution model.
waynr
force-pushed
the
cherry-pick/main/reauthing-object-store-fixes
branch
from
September 15, 2025 18:09
a2e0ca3 to
e4ec9a1
Compare
hiltontj
approved these changes
Sep 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a backport from the enterprise fork that addresses a bug in the
ReauthingObjectStore that would lead to tokio runtime deadlocks under certain
low thread count conditions.
fix(tokio): futures::executor::block_on is not compatible with tokio
futures::executor::block_on takes over the thread that calls it with a
while loop expecting another thread or runtime to drive the contained
future to completion. This doesn't work with tokio's runtime thread
expectations where it expects to swap tasks off threads as it likes.
While it doesn't always cause an issue with tokio, the futures block_on
can stall the tokio runtime.
The method tokio::task::block_in_place runs the contained closure in a
blocking manner without blocking the runtime. Within it then, you can
use Handle::current().block_on to enter an async context to execute
futures correctly on tokio's runtime.
These tokio versions are not compatible with the "current_thread"
runtime option of tokio.
This commit also includes the uri path when an authentical request to
the server's http api fails. This is useful for understand the target of
the unauthorized request.
It is not compatible with our execution model.