Increase wait timeout and add extra logs for Pipe Deadlock tests (dotnet/corefx#39436)
authorJustin Kotalik <jkotalik12@gmail.com>
Mon, 15 Jul 2019 20:20:10 +0000 (13:20 -0700)
committerStephen Toub <stoub@microsoft.com>
Mon, 15 Jul 2019 20:20:10 +0000 (16:20 -0400)
* Increase wait timeout and add extra logs

* nits

* Update FlushAsyncCancellationTests.cs

* Update ReadAsyncCancellationTests.cs

* This is what happens when you edit on github

* another one

Commit migrated from https://github.com/dotnet/corefx/commit/0de2d187a080a306b88cf57cc762a1ca601eceaa

src/libraries/System.IO.Pipelines/tests/FlushAsyncCancellationTests.cs
src/libraries/System.IO.Pipelines/tests/ReadAsyncCancellationTests.cs

index 361a3cb..e056134 100644 (file)
@@ -26,7 +26,7 @@ namespace System.IO.Pipelines.Tests
             ValueTaskAwaiter<FlushResult> awaiter = buffer.FlushAsync(cts.Token).GetAwaiter();
             awaiter.OnCompleted(
                 () => {
-                    // We are on cancellation thread and need to wait untill another FlushAsync call
+                    // We are on cancellation thread and need to wait until another FlushAsync call
                     // takes pipe state lock
                     e.Wait();
 
@@ -37,7 +37,7 @@ namespace System.IO.Pipelines.Tests
                     buffer.FlushAsync();
                 });
 
-            // Start a thread that would run cancellation calbacks
+            // 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
@@ -47,8 +47,8 @@ namespace System.IO.Pipelines.Tests
                     buffer.FlushAsync(cts2.Token);
                 });
 
-            bool completed = Task.WhenAll(cancellationTask, blockingTask).Wait(TimeSpan.FromSeconds(10));
-            Assert.True(completed);
+            bool completed = Task.WhenAll(cancellationTask, blockingTask).Wait(TimeSpan.FromSeconds(30));
+            Assert.True(completed, $"Flush tasks are not completed. CancellationTask: {cancellationTask.Status} BlockingTask: {blockingTask.Status}");
         }
 
         [Fact]
index fb3c0d6..6a92e16 100644 (file)
@@ -136,7 +136,7 @@ namespace System.IO.Pipelines.Tests
         }
 
         [Fact]
-        public void FlushAsyncCancellationDeadlock()
+        public void ReadAsyncCancellationDeadlock()
         {
             var cts = new CancellationTokenSource();
             var cts2 = new CancellationTokenSource();
@@ -145,7 +145,7 @@ namespace System.IO.Pipelines.Tests
             ValueTaskAwaiter<ReadResult> awaiter = Pipe.Reader.ReadAsync(cts.Token).GetAwaiter();
             awaiter.OnCompleted(
                 () => {
-                    // We are on cancellation thread and need to wait untill another ReadAsync call
+                    // We are on cancellation thread and need to wait until another ReadAsync call
                     // takes pipe state lock
                     e.Wait();
                     // Make sure we had enough time to reach _cancellationTokenRegistration.Dispose
@@ -154,7 +154,7 @@ namespace System.IO.Pipelines.Tests
                     Pipe.Reader.ReadAsync();
                 });
 
-            // Start a thread that would run cancellation calbacks
+            // Start a thread that would run cancellation callbacks
             Task cancellationTask = Task.Run(() => cts.Cancel());
             // Start a thread that would call ReadAsync with different token
             // and block on _cancellationTokenRegistration.Dispose
@@ -164,8 +164,8 @@ namespace System.IO.Pipelines.Tests
                     Pipe.Reader.ReadAsync(cts2.Token);
                 });
 
-            bool completed = Task.WhenAll(cancellationTask, blockingTask).Wait(TimeSpan.FromSeconds(10));
-            Assert.True(completed);
+            bool completed = Task.WhenAll(cancellationTask, blockingTask).Wait(TimeSpan.FromSeconds(30));
+            Assert.True(completed, $"Read tasks are not completed. CancellationTask: {cancellationTask.Status} BlockingTask: {blockingTask.Status}");
         }
 
         [Fact]