Skip to content

Add support for external Tokio runtimes in TokioAdapter#665

Open
riederm wants to merge 2 commits intocberner:masterfrom
riederm:support_existing_tokio_runtime
Open

Add support for external Tokio runtimes in TokioAdapter#665
riederm wants to merge 2 commits intocberner:masterfrom
riederm:support_existing_tokio_runtime

Conversation

@riederm
Copy link
Copy Markdown

@riederm riederm commented Mar 19, 2026

Adds a second constructor TokioAdapter::with_runtime to allow to
use an already instantiated tokio runtime rather than creating a
new one.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34c26c01cd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +156 to +159
pub fn with_runtime(inner: T, runtime_handle: tokio::runtime::Handle) -> Self {
Self {
inner: Arc::new(inner),
runtime: Runtime::External(runtime_handle),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the external Tokio runtime alive for the mount

TokioAdapter::with_runtime stores only a tokio::runtime::Handle, which can spawn onto a runtime but does not own it. That means a caller can mount successfully and still end up with an adapter whose executor disappears as soon as the original Runtime value is dropped or shut down—for example with spawn_mount(...) after setup code exits, or with a temporary Runtime::new()?.handle().clone(). In that state new FUSE requests are still accepted, but there is no longer a guaranteed live executor to run the async handlers, so the mount can stop servicing operations unexpectedly.

Useful? React with 👍 / 👎.

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.

1 participant