This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Fix ReadAsync not returning when cancellation token fires during FlushAsync#31212
Merged
pakrym merged 3 commits intodotnet:masterfrom Jul 24, 2018
Merged
Fix ReadAsync not returning when cancellation token fires during FlushAsync#31212pakrym merged 3 commits intodotnet:masterfrom
pakrym merged 3 commits intodotnet:masterfrom
Conversation
halter73
approved these changes
Jul 19, 2018
ahsonkhan
approved these changes
Jul 19, 2018
| // AttachToken before completing reader awaiter in case cancellationToken is already completed | ||
| cancellationTokenRegistration = _writerAwaitable.AttachToken(cancellationToken, s_signalWriterAwaitable, this); | ||
|
|
||
| // If the writer is completed (which it will be most of the time) the return a completed ValueTask |
There was a problem hiding this comment.
nit: then return a completed ValueTask
| } | ||
| }); | ||
|
|
||
| Assert.True(Task.WaitAll(new [] { writer, reader, canceller }, TimeSpan.FromSeconds(30)), "Reader was not completed in reasonable time"); |
There was a problem hiding this comment.
Isn't potentially spending 30 seconds on a single unit test too long? Does the test still work as intended if we change this to < 5 seconds?
Author
There was a problem hiding this comment.
Only if fails. I don't want to introduce the test that would be flaky on slower machines. In the successful case, it passes quickly.
| var writer = Task.Run(async () => | ||
| { | ||
| var cancellations = 0; | ||
| while (cancellations < 20) |
| } | ||
| catch (OperationCanceledException) | ||
| { | ||
| cancellations ++; |
pakrym
added a commit
to pakrym/corefx
that referenced
this pull request
Jul 27, 2018
pakrym
added a commit
to pakrym/corefx
that referenced
this pull request
Aug 21, 2018
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
…hAsync (dotnet/corefx#31212) Commit migrated from dotnet/corefx@3cf0de3
This file contains hidden or 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
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.
Fixes #31201