Skip to content

Commit 595a4e1

Browse files
authored
Disable debugger initialization if it's not enabled initially (#7398)
## Summary of changes Disables the debugger initialization if it's not explicitly enabled ## Reason for change We have been seeing some hangs in CI which seem to be caused by the debugger (based on log messages) and I suspect are due to [this refactoring](015d218). Rather than revert that large piece of refactoring (and causing massive conflicts for the [remote-enablement PR](#7366)), for now we primarily want to ensure customers _not_ using the debugger are not impacted. ## Implementation details Check the debugger and exception replay settings to see if the debugger is required. If not, bail out of initialization immediately. ## Test coverage This is the test
1 parent b47030b commit 595a4e1

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

tracer/src/Datadog.Trace/ClrProfiler/Instrumentation.cs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -445,18 +445,24 @@ private static void StartDiagnosticManager()
445445

446446
private static void InitializeDebugger(TracerSettings tracerSettings)
447447
{
448-
_ = Task.Run(
449-
async () =>
450-
{
451-
try
452-
{
453-
await DebuggerManager.Instance.UpdateConfiguration(tracerSettings).ConfigureAwait(false);
454-
}
455-
catch (Exception ex)
448+
var manager = DebuggerManager.Instance;
449+
if (manager.DebuggerSettings.CodeOriginForSpansEnabled
450+
|| manager.DebuggerSettings.DynamicInstrumentationEnabled
451+
|| manager.ExceptionReplaySettings.Enabled)
452+
{
453+
_ = Task.Run(
454+
async () =>
456455
{
457-
Log.Error(ex, "Error initializing debugger");
458-
}
459-
});
456+
try
457+
{
458+
await DebuggerManager.Instance.UpdateConfiguration(tracerSettings).ConfigureAwait(false);
459+
}
460+
catch (Exception ex)
461+
{
462+
Log.Error(ex, "Error initializing debugger");
463+
}
464+
});
465+
}
460466
}
461467

462468
// /!\ This method is called by reflection in the SampleHelpers

0 commit comments

Comments
 (0)