From 07daa30ccb0de0dce18e4b82daf57611c371d08d Mon Sep 17 00:00:00 2001 From: Andrew Lock Date: Thu, 3 Oct 2024 17:44:48 +0100 Subject: [PATCH 1/2] Add check that the profiler library path is set and exists before calling it --- tracer/src/Datadog.Tracer.Native/cor_profiler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tracer/src/Datadog.Tracer.Native/cor_profiler.cpp b/tracer/src/Datadog.Tracer.Native/cor_profiler.cpp index 9441009da13a..74b15e4837f6 100644 --- a/tracer/src/Datadog.Tracer.Native/cor_profiler.cpp +++ b/tracer/src/Datadog.Tracer.Native/cor_profiler.cpp @@ -942,7 +942,10 @@ HRESULT CorProfiler::TryRejitModule(ModuleID module_id, std::vector& m if (ShouldRewriteProfilerMaps()) { auto profiler_library_path = shared::GetEnvironmentValue(WStr("DD_INTERNAL_PROFILING_NATIVE_ENGINE_PATH")); - RewritingPInvokeMaps(module_metadata, WStr("continuous profiler"), profiler_nativemethods_type, profiler_library_path); + if (!profiler_library_path.empty() && fs::exists(profiler_library_path)) + { + RewritingPInvokeMaps(module_metadata, WStr("continuous profiler"), profiler_nativemethods_type, profiler_library_path); + } } if (IsVersionCompatibilityEnabled()) From fe1605afc3f15d95b670770b28bd87507d0dffa1 Mon Sep 17 00:00:00 2001 From: Andrew Lock Date: Fri, 4 Oct 2024 14:31:27 +0100 Subject: [PATCH 2/2] "fix" the issue --- tracer/test/Datadog.Trace.TestHelpers/EnvironmentHelper.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tracer/test/Datadog.Trace.TestHelpers/EnvironmentHelper.cs b/tracer/test/Datadog.Trace.TestHelpers/EnvironmentHelper.cs index ea28880642ce..4f6d5b5b6268 100644 --- a/tracer/test/Datadog.Trace.TestHelpers/EnvironmentHelper.cs +++ b/tracer/test/Datadog.Trace.TestHelpers/EnvironmentHelper.cs @@ -195,6 +195,10 @@ public void SetEnvironmentVariables( // see https://github.com/DataDog/dd-trace-dotnet/pull/3579 environmentVariables["DD_INTERNAL_WORKAROUND_77973_ENABLED"] = "1"; + // In some scenarios (.NET 6, SSI run enabled) enabling procdump makes + // grabbing a stack trace _crazy_ expensive (10s). Setting this "fixes" it. + environmentVariables["_NO_DEBUG_HEAP"] = "1"; + // Set a canary variable that should always be ignored // and check that it doesn't appear in the logs environmentVariables["SUPER_SECRET_CANARY"] = "MySuperSecretCanary";