Attempt to prevent crash on module unload#8854
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8854) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8854) - mean (72ms) : 67, 77
master - mean (70ms) : 68, 72
section Bailout
This PR (8854) - mean (76ms) : 73, 79
master - mean (74ms) : 72, 75
section CallTarget+Inlining+NGEN
This PR (8854) - mean (1,084ms) : 1039, 1129
master - mean (1,081ms) : 1030, 1132
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8854) - mean (113ms) : 106, 121
master - mean (109ms) : 105, 112
section Bailout
This PR (8854) - mean (111ms) : 107, 116
master - mean (110ms) : 108, 112
section CallTarget+Inlining+NGEN
This PR (8854) - mean (777ms) : 758, 797
master - mean (779ms) : 756, 803
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8854) - mean (99ms) : 94, 105
master - mean (99ms) : 93, 106
section Bailout
This PR (8854) - mean (98ms) : 96, 100
master - mean (100ms) : 96, 104
section CallTarget+Inlining+NGEN
This PR (8854) - mean (937ms) : 887, 988
master - mean (935ms) : 898, 972
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8854) - mean (95ms) : 93, 97
master - mean (96ms) : 90, 103
section Bailout
This PR (8854) - mean (100ms) : 93, 106
master - mean (102ms) : 96, 108
section CallTarget+Inlining+NGEN
This PR (8854) - mean (811ms) : 778, 845
master - mean (818ms) : 772, 863
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8854) - mean (202ms) : 197, 206
master - mean (203ms) : 197, 208
section Bailout
This PR (8854) - mean (206ms) : 202, 209
master - mean (208ms) : 203, 213
section CallTarget+Inlining+NGEN
This PR (8854) - mean (1,216ms) : 1171, 1260
master - mean (1,213ms) : 1172, 1254
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8854) - mean (290ms) : 285, 295
master - mean (291ms) : 285, 297
section Bailout
This PR (8854) - mean (291ms) : 286, 297
master - mean (312ms) : 302, 323
section CallTarget+Inlining+NGEN
This PR (8854) - mean (973ms) : 951, 995
master - mean (1,008ms) : 929, 1086
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8854) - mean (282ms) : 276, 288
master - mean (286ms) : 279, 293
section Bailout
This PR (8854) - mean (282ms) : 276, 287
master - mean (284ms) : 278, 290
section CallTarget+Inlining+NGEN
This PR (8854) - mean (1,170ms) : 1131, 1209
master - mean (1,168ms) : 1133, 1203
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8854) - mean (280ms) : 274, 286
master - mean (285ms) : 279, 292
section Bailout
This PR (8854) - mean (279ms) : 274, 284
master - mean (282ms) : 276, 288
section CallTarget+Inlining+NGEN
This PR (8854) - mean (1,047ms) : 1006, 1088
master - mean (1,052ms) : 1012, 1092
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BenchmarksBenchmark execution time: 2026-06-30 13:56:19 Comparing candidate commit 0b13cba in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 72 metrics, 0 unstable metrics, 59 known flaky benchmarks, 67 flaky benchmarks without significant changes.
|
Summary of changes
Avoid querying CLR module metadata during
ModuleUnloadStarted; clean up cached profiler module/AppDomain state using locally tracked module ids instead.Reason for change
Calling back into the CLR for module info while a module is unloading can fault inside runtime teardown and crash the instrumented process (or at least that is what it appears so).
Implementation details
Synchronize access to
managed_profiler_loaded_app_domains, make the domain-neutral profiler module id atomic, remove unloaded module ids from cached profiler state, and only clean up AppDomain-scoped state after successful AppDomain unload.This mainly removes the call to
GetModuleInfoduring the unload event.Test coverage
Unsure really, I haven't been able to reproduce this hoping that existing tests cover the change 😬
Other details
https://app.datadoghq.com/error-tracking/issue/f7978b74-55cd-11f1-8366-da7ad0900002