Description
With tokio_unstable, the io-uring feature, and Linux fs support enabled, several tokio::fs APIs probe the runtime io_uring driver before falling back to the blocking filesystem path. Those probes call the panicking driver().io() accessor.
If a Tokio runtime exists but was built without IO enabled, these filesystem operations can panic before reaching the existing spawn_blocking fallback.
Affected paths
Examples include:
tokio::fs::read
tokio::fs::write
tokio::fs::OpenOptions::open
tokio::fs::File reads from File::from_std
Example
let rt = tokio::runtime::Builder::new_current_thread()
.build()
.unwrap();
rt.block_on(async {
let _ = tokio::fs::read("foo.txt").await;
});
In an io_uring-enabled build, this can panic with the IO-disabled runtime message before falling back to the blocking filesystem implementation.
Expected behavior
If the runtime has no IO driver, the optional io_uring path should be skipped and filesystem operations should use the existing blocking fallback. This matches the existing fallback behavior when io_uring is unavailable or unsupported.
Notes
This is limited to Linux tokio_unstable + io-uring builds, so it does not affect normal stable Tokio builds.
Description
With
tokio_unstable, theio-uringfeature, and Linux fs support enabled, severaltokio::fsAPIs probe the runtime io_uring driver before falling back to the blocking filesystem path. Those probes call the panickingdriver().io()accessor.If a Tokio runtime exists but was built without IO enabled, these filesystem operations can panic before reaching the existing
spawn_blockingfallback.Affected paths
Examples include:
tokio::fs::readtokio::fs::writetokio::fs::OpenOptions::opentokio::fs::Filereads fromFile::from_stdExample
In an io_uring-enabled build, this can panic with the IO-disabled runtime message before falling back to the blocking filesystem implementation.
Expected behavior
If the runtime has no IO driver, the optional io_uring path should be skipped and filesystem operations should use the existing blocking fallback. This matches the existing fallback behavior when io_uring is unavailable or unsupported.
Notes
This is limited to Linux
tokio_unstable+io-uringbuilds, so it does not affect normal stable Tokio builds.