From b206e4cc37bf380cdb8ffad04ec287ed84c932b8 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Fri, 4 Dec 2020 09:03:28 -0800 Subject: [PATCH] Increase CoreCLR dump information This sets environment variables that will help make the dumps for a CLR bug more actionable by the runtime team. https://github.com/dotnet/runtime/issues/45557 --- .../Source/RunTests/ProcessTestExecutor.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Tools/Source/RunTests/ProcessTestExecutor.cs b/src/Tools/Source/RunTests/ProcessTestExecutor.cs index beea2ab3bc66c..15ba570a44074 100644 --- a/src/Tools/Source/RunTests/ProcessTestExecutor.cs +++ b/src/Tools/Source/RunTests/ProcessTestExecutor.cs @@ -9,6 +9,7 @@ using System.Collections.Immutable; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -120,6 +121,7 @@ private async Task RunTestAsyncInternal(AssemblyInfo assemblyInfo, b // Define environment variables for processes started via ProcessRunner. var environmentVariables = new Dictionary(); Options.ProcDumpInfo?.WriteEnvironmentVariables(environmentVariables); + MaybeAddStressEnvironmentVariables(); if (retry && File.Exists(resultsFilePath)) { @@ -216,6 +218,23 @@ private async Task RunTestAsyncInternal(AssemblyInfo assemblyInfo, b testResultInfo, commandLineArguments, processResults: ImmutableArray.CreateRange(processResultList)); + + void MaybeAddStressEnvironmentVariables() + { +#if NETCOREAPP + // These environment variables will generate better dump information for the runtime team + // that will help them track down a GC issue that is impacting ConcurrentDictionary + // https://github.com/dotnet/runtime/issues/45557 + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + environmentVariables.Add("COMPlus_StressLog", "1"); + environmentVariables.Add("COMPlus_LogLevel", "6"); + environmentVariables.Add("COMPlus_LogFacility", "0x00080001"); + environmentVariables.Add("COMPlus_StressLogSize", "2000000"); + environmentVariables.Add("COMPlus_TotalStressLogSize", "40000000"); + } + } +#endif } catch (Exception ex) {