From: Justin Kotalik Date: Mon, 15 Jul 2019 20:20:10 +0000 (-0700) Subject: Increase wait timeout and add extra logs for Pipe Deadlock tests (dotnet/corefx#39436) X-Git-Tag: submit/tizen/20210909.063632~11031^2~935 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5b183eb08728dd25ea06aea0609666b76851127;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Increase wait timeout and add extra logs for Pipe Deadlock tests (dotnet/corefx#39436) * 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 --- diff --git a/src/libraries/System.IO.Pipelines/tests/FlushAsyncCancellationTests.cs b/src/libraries/System.IO.Pipelines/tests/FlushAsyncCancellationTests.cs index 361a3cb..e056134 100644 --- a/src/libraries/System.IO.Pipelines/tests/FlushAsyncCancellationTests.cs +++ b/src/libraries/System.IO.Pipelines/tests/FlushAsyncCancellationTests.cs @@ -26,7 +26,7 @@ namespace System.IO.Pipelines.Tests ValueTaskAwaiter 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] diff --git a/src/libraries/System.IO.Pipelines/tests/ReadAsyncCancellationTests.cs b/src/libraries/System.IO.Pipelines/tests/ReadAsyncCancellationTests.cs index fb3c0d6..6a92e16 100644 --- a/src/libraries/System.IO.Pipelines/tests/ReadAsyncCancellationTests.cs +++ b/src/libraries/System.IO.Pipelines/tests/ReadAsyncCancellationTests.cs @@ -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 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]