Syncronize cancellation in ReadAsyncCompletesIfFlushAsyncCanceledMidFlush#31365
Syncronize cancellation in ReadAsyncCompletesIfFlushAsyncCanceledMidFlush#31365pakrym merged 1 commit intodotnet:masterfrom
Conversation
Does this guarantee the test will always pass or do you expect to see intermittent failures due to timeouts going forward? If so, what would be the course of action then? |
| return; | ||
| } | ||
|
|
||
| resetEvent.Reset(); |
There was a problem hiding this comment.
Can you help me understand why this re-ordering was necessary?
There was a problem hiding this comment.
So resetEvent is Set when reader completes so canceller doesn't block on WaitOne.
There was a problem hiding this comment.
So
resetEventisSetwhen reader completes
Do you mean Reset? And why not move it to the very end of the loop (after the call to AdvanceTo)?
There was a problem hiding this comment.
No, I mean Set. So canceller can loop and exit.
Unfortunately, it's inherently racy test.
There was one failure right now I expect this PR to significantly speed test up.
Caping the infinite loop, but that would lower the chance of reproing the original bug. |
…lush (dotnet/corefx#31365) Commit migrated from dotnet/corefx@dd4a308
https://github.com/dotnet/corefx/issues/31349
Synchronizing
cancellationTokenSource.Cancel();loop withFlushAsyncdecreases amount of iterations required 10x on my machine.Should make the test more stable.