diff --git a/src/Http/Http/test/FlushResultCancellationTests.cs b/src/Http/Http/test/FlushResultCancellationTests.cs index f4ab7cb96f..1251b60ebe 100644 --- a/src/Http/Http/test/FlushResultCancellationTests.cs +++ b/src/Http/Http/test/FlushResultCancellationTests.cs @@ -12,44 +12,6 @@ namespace Microsoft.AspNetCore.Http.Tests { public class FlushResultCancellationTests : PipeTest { - [Fact] - public void FlushAsyncCancellationDeadlock() - { - var cts = new CancellationTokenSource(); - var cts2 = new CancellationTokenSource(); - - PipeWriter buffer = Writer.WriteEmpty(MaximumSizeHigh); - - var e = new ManualResetEventSlim(); - - ValueTaskAwaiter awaiter = buffer.FlushAsync(cts.Token).GetAwaiter(); - awaiter.OnCompleted( - () => { - // We are on cancellation thread and need to wait until another FlushAsync call - // takes pipe state lock - e.Wait(); - - // Make sure we had enough time to reach _cancellationTokenRegistration.Dispose - Thread.Sleep(100); - - // Try to take pipe state lock - buffer.FlushAsync(); - }); - - // Start a thread that would run cancellation callbacks - Task cancellationTask = Task.Run(() => cts.Cancel()); - // Start a thread that would call FlushAsync with different token - // and block on _cancellationTokenRegistration.Dispose - Task blockingTask = Task.Run( - () => { - e.Set(); - buffer.FlushAsync(cts2.Token); - }); - - bool completed = Task.WhenAll(cancellationTask, blockingTask).Wait(TimeSpan.FromSeconds(10)); - Assert.True(completed); - } - [Fact] public async Task FlushAsyncWithNewCancellationTokenNotAffectedByPrevious() {