-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[7.0] Fix reporting of an async IO timeout error on Windows (SerialPort
)
#81745
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ort`) - Port of dotnet#81744 - When an async `SerialPort` IO operation times out, it reports the timeout in the IO completion with an `NTSTATUS` value of `WAIT_TIMEOUT` (258) - In the thread pool when using `GetQueuedCompletionStatusEx`, the `NTSTATUS` value was being checked against `STATUS_SUCCESS` to determine success, so the `WAIT_TIMEOUT` was reported as an error. This leads to a different exception being thrown, compared to before when `GetQueuedCompletionStatus` was used. - Fixed to use similar logic to the SDK's `NT_SUCCESS` macro, which treats the `WAIT_TIMEOUT` value as a success, which is similar to what `GetQueuedCompletionStatus` does - There are already tests that verify this behavior in `System.IO.Ports` tests, though [they are currently disabled](https://github.com/dotnet/runtime/blob/b39d6a6eb44860746e91e5ce4f585beff33d1f63/src/libraries/System.IO.Ports/tests/Support/TCSupport.cs#L108-L118) due to instabilities. I have verified locally that the relevant failures are fixed and that there are no new failures in those tests. Relevant to dotnet#80079
Tagging subscribers to this area: @mangod9 Issue Details
Port of fix for #80079
|
jeffschwMSFT
approved these changes
Feb 7, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved. we will take for consideration in 7.0.x
rbhanda
added
Servicing-approved
Approved for servicing release
and removed
Servicing-consider
Issue for next servicing release review
labels
Feb 7, 2023
mangod9
approved these changes
Feb 8, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SerialPort
) #81744SerialPort
IO operation times out, it reports the timeout in the IO completion with anNTSTATUS
value ofWAIT_TIMEOUT
(258)GetQueuedCompletionStatusEx
, theNTSTATUS
value was being checked againstSTATUS_SUCCESS
to determine success, so theWAIT_TIMEOUT
was reported as an error. This leads to a different exception being thrown, compared to before whenGetQueuedCompletionStatus
was used.NT_SUCCESS
macro, which treats theWAIT_TIMEOUT
value as a success, which is similar to whatGetQueuedCompletionStatus
doesSystem.IO.Ports
tests, though they are currently disabled due to instabilities. I have verified locally that the relevant failures are fixed and that there are no new failures in those tests.Port of fix for #80079
Customer Impact
A
SerialPort
IO operation that times out raises anIOException
instead of the documentedTimeoutException
. Some customers have reported the issue and that it has broken several apps usingSerialPort
on Windows. There is a runtime config option that can be configured to revert the change in behavior, which serves as a workaround. Another workaround is to catch theIOException
and check the error code.Regression?
Yes, from 6.0
Testing
Verified with the repro that the behavior is the same as before
Risk
Low. .NET 6 uses
GetQueuedCompletionStatus
, and after the change the behavior is closer to whatGetQueuedCompletionStatus
does.