Skip to content

fix(tokio): futures::executor::block_on is not compatible with tokio - #26804

Merged
waynr merged 1 commit into
mainfrom
cherry-pick/main/reauthing-object-store-fixes
Sep 15, 2025
Merged

fix(tokio): futures::executor::block_on is not compatible with tokio#26804
waynr merged 1 commit into
mainfrom
cherry-pick/main/reauthing-object-store-fixes

Conversation

@waynr

@waynr waynr commented Sep 15, 2025

Copy link
Copy Markdown
Contributor

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

  • 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.

* 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
waynr force-pushed the cherry-pick/main/reauthing-object-store-fixes branch from a2e0ca3 to e4ec9a1 Compare September 15, 2025 18:09
@waynr
waynr requested a review from a team September 15, 2025 18:11
@waynr
waynr merged commit 8e8a1b9 into main Sep 15, 2025
12 checks passed
@waynr
waynr deleted the cherry-pick/main/reauthing-object-store-fixes branch September 15, 2025 18:42
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.

3 participants