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
tokio::fs::DirEntry::path
returns type that does blocking IO
#5192
Comments
The way |
To be clear, In non-networked file systems, checking whether a file exists wouldn't really block the executor because most file systems are able to return that information pretty quickly, and I'm not entirely convinced that it makes sense to orient Tokio's API around the (relatively niche) networked file system use-case. |
Regardless, it isn't anything we can change. |
I was thinking of perhaps adding a small note/warning in https://docs.rs/tokio/latest/tokio/fs/index.html, that care should be taken when using methods on Thoughts? |
I mean, I figured it out and workarounds, but mostly want to make things simpler for the next person stumbling upon this. |
I would be happy to see more documentation. |
This function:
https://docs.rs/tokio/latest/tokio/fs/struct.DirEntry.html#method.path
Returns this type:
https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html
But this type's methods do blocking IO (e.g.:
.exists()
). This completely messes up services which use higher latency network mounts by freezing async threads with blocking IO when doing disk access.The text was updated successfully, but these errors were encountered: