-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
FileStream.FlushAsync ends up doing synchronous writes #27643
Comments
This is a troubling fix NuGet/NuGet.Client#2488 😢 |
That is actually the fix/workaround I've recommended: setting useAsync:false. As far as I can tell, there's little benefit in that scenario for using overlapped I/O, and even if FileStream were perfect, there's overhead to overlapped I/O. |
Yeah, don't mean its not the right fix for usage; just mean FileStream needs some TLC for async. Though when I tried it before, I did find it was quite complicated to improve... |
It definitely does. :) |
This cannot fit in 3.0. It's on the radar for v next. |
https://github.com/dotnet/coreclr/blob/85ed652fef5f1dec7c532bd4963dd3cde0199211/src/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs#L1547-L1561
and
This is particularly problematic when the FileStream is configured to use async I/O on Windows, as then FlushWriteBuffer needs to use sync-over-async to do the write, queueing the overlapped I/O and then blocking waiting for the operation to complete... so we have the asynchronous FlushAsync synchronously blocking waiting for the overlapped I/O to complete. Ugh.
Related to https://github.com/dotnet/corefx/issues/31914#issuecomment-427120612
Related to https://github.com/dotnet/corefx/issues/6007
Related to https://github.com/dotnet/corefx/issues/6039
Related to https://github.com/dotnet/corefx/issues/29129
Related to https://github.com/dotnet/corefx/issues/27226
cc: @JeremyKuhne, @danmosemsft
The text was updated successfully, but these errors were encountered: