-
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
[release/6.0] Enforce scatter/gather file I/O Windows API requirements et. al. #58423
Conversation
And use pinned GCHandles and IntPtrs instead of MemoryHandles when passing the segment array to the bottom-most method.
…ddrOfPinnedObject.
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsBackport of #57424 to release/6.0 /cc @adamsitnik @teo-tsirpanis Customer ImpactTestingRisk
|
I suggest we wait until #58447 is merged, where I will subsequently submit a PR of these changes against the head of this PR's branch. |
What is the risk to the feature itself though? This seems like a significant change to a somewhat complex/perf sensitive area. |
@dotnet/area-system-io is this backport something you support? we need a call one way or another. I haven't dug into it. |
It is something that we support and want as part of .NET 6, but we need to wait until #58447 is merged. |
@dotnet/area-system-io If we are still wanting to get this in for 6.0, it'll need to be presented to tactics this week. |
* Allocate an array of memory handles only if needed. * Remove an unnecessary variable in the multiple-syscall write gather. * Actually verify the content read by the read scatter operation. * Delay allocating native memory. * Verify that the whole file was read in the scatter/gather test. * Test the case when the scatter/gather buffers are acceptable by the Windows API. * Avoid null pointer dereferences when passing an empty segment array. * Test performing scatter/gather I/O with an empty segment array. Co-authored-by: Stephen Toub <stoub@microsoft.com>
@jeffhandley I've cherry-picked the changes from follow-up PR (#58447) and tested it locally. Once the CI is green we can merge it. It's not a release blocker as it's fixing a bug for a feature which very few know that we actually support (NO_BUFFERING). |
Thanks. To confirm, is the fix breaking in any way at all in the edge case usage? |
No, the algorithm falls back to issuing many syscalls for each buffer segment. |
Failing check is #48717. |
Backport of #57424 to release/6.0
/cc @adamsitnik @teo-tsirpanis
Customer Impact
Without this fix, users of
RandomAccess.ReadAsync(IReadOnlyList<Memory<byte>>)
andRandomAccess.WriteAsync(IReadOnlyList<ReadOnlyMemory<byte>>)
might get an IO exception for a valid input on Windows.Testing
In #57717 (before the ported PR got merged) we have added new tests to extend the NO_BUFFERING tests and cover all scenarios.
In #57424 (what we are backporting here) a unit test that was failing before the fix has been added. It's now passing.
To ensure there is no perf regression new benchmarks have been added to performance repo: dotnet/performance#1967 and run manually on a Windows machine.
Risk
Low, as it's a bug fix for a feature that has been introduced in .NET 6 and has not been widely adopted yet.