From cb71b60b08b3bfd8c0cc17372240931ff2818eff Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Sat, 1 Jun 2024 16:39:53 -0700 Subject: [PATCH] Add retry loop around Process.Kill(entireProcessTree: true) (#102958) Workaround #93321 --- .../Coreclr.TestWrapper/CoreclrTestWrapperLib.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tests/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs b/src/tests/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs index 69f3a302f1d4a..020eb7cd9c672 100644 --- a/src/tests/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs +++ b/src/tests/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs @@ -305,7 +305,18 @@ static bool CollectCrashDumpWithCreateDump(Process process, string crashDumpPath } else { - createdump.Kill(true); + // Workaround for https://github.com/dotnet/runtime/issues/93321 + for (int i = 0; i < 5; i++) + { + try + { + createdump.Kill(entireProcessTree: true); + } + catch (Exception e) + { + Console.WriteLine($"Process.Kill(entireProcessTree: true) failed with {e}. Retrying."); + } + } } return fSuccess && createdump.ExitCode == 0;