Skip to content

[Profiler] Fix crash when calling GetAppDomainInfo#8076

Merged
gleocadie merged 2 commits intomasterfrom
gleocadie/attempt-to-fix-crash-getappdomaininfo
Jan 21, 2026
Merged

[Profiler] Fix crash when calling GetAppDomainInfo#8076
gleocadie merged 2 commits intomasterfrom
gleocadie/attempt-to-fix-crash-getappdomaininfo

Conversation

@gleocadie
Copy link
Collaborator

@gleocadie gleocadie commented Jan 15, 2026

Summary of changes

Fixing a crash when the profiler calls GetAppDomainInfo.

Reason for change

There might be a race at some point (the appdomain being destroyed and the profiler calling into the CLR to get the AppDomain name).

image

Implementation details

  • Use the existing AppDomainStore to collect AppDomain name
  • Use the collecting name, avoiding calling into GetAppDomainInfo.

Test coverage

  • I tried to reproduce the issue but even at shutdown, calls into GetAppDomainInfo for an unloaded AppDomain does not crash.
  • Just added a test to check that we collect the correct AppDomain name

Other details

@github-actions github-actions bot added the area:profiler Issues related to the continous-profiler label Jan 15, 2026
@pr-commenter
Copy link

pr-commenter bot commented Jan 15, 2026

Benchmarks

Benchmark execution time: 2026-01-19 09:22:33

Comparing candidate commit d286b90 in PR branch gleocadie/attempt-to-fix-crash-getappdomaininfo with baseline commit 0e23a10 in branch master.

Found 9 performance improvements and 4 performance regressions! Performance is the same for 159 metrics, 20 unstable metrics.

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 execution_time [-16.866ms; -10.875ms] or [-7.985%; -5.149%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-20.111ms; -14.291ms] or [-9.310%; -6.615%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+25.209ms; +25.724ms] or [+14.252%; +14.543%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1

  • 🟩 execution_time [-61.813µs; -33.946µs] or [-16.696%; -9.169%]
  • 🟩 throughput [+254.653op/s; +437.870op/s] or [+9.224%; +15.860%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 throughput [-61708579.020op/s; -60621882.926op/s] or [-31.084%; -30.536%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • 🟩 throughput [+740.359op/s; +1659.117op/s] or [+8.012%; +17.954%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟩 execution_time [-16.850ms; -11.943ms] or [-7.816%; -5.540%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0

  • 🟥 execution_time [+159.065µs; +164.375µs] or [+11.445%; +11.828%]
  • 🟥 throughput [-76.155op/s; -73.842op/s] or [-10.584%; -10.262%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • 🟩 execution_time [-957.844µs; -706.421µs] or [-33.886%; -24.991%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • 🟩 throughput [+2047.920op/s; +4028.154op/s] or [+10.038%; +19.744%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟩 throughput [+14236452.913op/s; +15511593.552op/s] or [+6.307%; +6.871%]

@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Jan 15, 2026

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8076) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration68.20 ± (68.25 - 68.43) ms68.26 ± (68.33 - 68.54) ms+0.1%✅⬆️
.NET Framework 4.8 - Bailout
duration72.33 ± (72.16 - 72.38) ms72.09 ± (72.05 - 72.28) ms-0.3%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1002.46 ± (1007.75 - 1017.31) ms1008.10 ± (1016.42 - 1027.84) ms+0.6%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms21.82 ± (21.80 - 21.85) ms21.82 ± (21.78 - 21.85) ms-0.0%
process.time_to_main_ms78.59 ± (78.45 - 78.73) ms78.74 ± (78.60 - 78.89) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.91 ± (10.90 - 10.91) MB10.91 ± (10.91 - 10.91) MB+0.0%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms21.83 ± (21.80 - 21.87) ms21.84 ± (21.82 - 21.87) ms+0.0%✅⬆️
process.time_to_main_ms79.72 ± (79.63 - 79.81) ms79.97 ± (79.87 - 80.07) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.94 - 10.95) MB10.95 ± (10.95 - 10.96) MB+0.1%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms241.80 ± (238.51 - 245.08) ms243.63 ± (240.12 - 247.13) ms+0.8%✅⬆️
process.time_to_main_ms468.78 ± (468.25 - 469.31) ms470.23 ± (469.70 - 470.77) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.39 ± (48.37 - 48.42) MB48.38 ± (48.35 - 48.40) MB-0.0%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.3%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms20.64 ± (20.61 - 20.66) ms20.74 ± (20.72 - 20.77) ms+0.5%✅⬆️
process.time_to_main_ms68.12 ± (68.00 - 68.25) ms68.31 ± (68.19 - 68.42) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.61 ± (10.60 - 10.61) MB10.63 ± (10.63 - 10.64) MB+0.3%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms20.62 ± (20.60 - 20.64) ms20.78 ± (20.75 - 20.81) ms+0.8%✅⬆️
process.time_to_main_ms69.11 ± (69.05 - 69.17) ms69.51 ± (69.45 - 69.57) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.66 ± (10.65 - 10.66) MB10.75 ± (10.73 - 10.77) MB+0.9%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms244.21 ± (241.80 - 246.61) ms246.06 ± (243.71 - 248.41) ms+0.8%✅⬆️
process.time_to_main_ms445.79 ± (445.34 - 446.25) ms447.55 ± (447.10 - 448.00) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed49.08 ± (49.05 - 49.11) MB49.17 ± (49.13 - 49.20) MB+0.2%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.0%
.NET 8 - Baseline
process.internal_duration_ms18.78 ± (18.75 - 18.81) ms18.74 ± (18.71 - 18.77) ms-0.2%
process.time_to_main_ms67.21 ± (67.09 - 67.33) ms67.17 ± (67.06 - 67.27) ms-0.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.65 ± (7.65 - 7.66) MB7.68 ± (7.68 - 7.69) MB+0.4%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms18.83 ± (18.80 - 18.85) ms18.74 ± (18.71 - 18.77) ms-0.5%
process.time_to_main_ms68.47 ± (68.40 - 68.55) ms68.26 ± (68.20 - 68.32) ms-0.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.71 ± (7.70 - 7.72) MB7.72 ± (7.71 - 7.73) MB+0.1%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms177.28 ± (176.44 - 178.13) ms178.48 ± (177.67 - 179.29) ms+0.7%✅⬆️
process.time_to_main_ms428.74 ± (428.08 - 429.40) ms430.00 ± (429.35 - 430.64) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.49 ± (36.46 - 36.53) MB36.55 ± (36.52 - 36.58) MB+0.2%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.0%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration192.14 ± (191.92 - 192.71) ms193.70 ± (193.57 - 194.47) ms+0.8%✅⬆️
.NET Framework 4.8 - Bailout
duration195.23 ± (194.93 - 195.43) ms200.15 ± (199.59 - 200.52) ms+2.5%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1115.71 ± (1119.45 - 1129.34) ms1133.92 ± (1133.58 - 1143.70) ms+1.6%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms186.16 ± (185.79 - 186.52) ms186.95 ± (186.60 - 187.29) ms+0.4%✅⬆️
process.time_to_main_ms80.45 ± (80.26 - 80.64) ms80.66 ± (80.45 - 80.88) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.13 ± (16.10 - 16.16) MB16.12 ± (16.09 - 16.15) MB-0.0%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (19 - 20)-1.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms186.36 ± (186.07 - 186.66) ms186.56 ± (186.26 - 186.87) ms+0.1%✅⬆️
process.time_to_main_ms81.59 ± (81.45 - 81.73) ms82.32 ± (82.12 - 82.53) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.15 ± (16.12 - 16.17) MB16.12 ± (16.10 - 16.14) MB-0.2%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (20 - 21)-0.8%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms429.31 ± (426.42 - 432.21) ms428.79 ± (425.82 - 431.77) ms-0.1%
process.time_to_main_ms469.73 ± (469.21 - 470.25) ms472.74 ± (472.04 - 473.44) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.82 ± (58.70 - 58.94) MB58.57 ± (58.44 - 58.71) MB-0.4%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.0%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms190.82 ± (190.38 - 191.26) ms191.40 ± (190.94 - 191.85) ms+0.3%✅⬆️
process.time_to_main_ms70.07 ± (69.86 - 70.27) ms70.31 ± (70.11 - 70.51) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.85 ± (15.68 - 16.01) MB16.09 ± (15.97 - 16.22) MB+1.5%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 19)+1.9%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms189.58 ± (189.34 - 189.82) ms191.27 ± (190.83 - 191.72) ms+0.9%✅⬆️
process.time_to_main_ms70.86 ± (70.74 - 70.98) ms71.50 ± (71.32 - 71.68) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.87 ± (15.70 - 16.05) MB16.13 ± (15.99 - 16.27) MB+1.6%✅⬆️
runtime.dotnet.threads.count19 ± (18 - 19)19 ± (19 - 19)+3.8%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms438.58 ± (434.75 - 442.41) ms438.69 ± (435.28 - 442.09) ms+0.0%✅⬆️
process.time_to_main_ms448.69 ± (448.17 - 449.20) ms449.73 ± (449.21 - 450.25) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed58.77 ± (58.63 - 58.91) MB58.71 ± (58.59 - 58.83) MB-0.1%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.0%
.NET 8 - Baseline
process.internal_duration_ms188.47 ± (188.17 - 188.77) ms190.27 ± (189.78 - 190.75) ms+1.0%✅⬆️
process.time_to_main_ms69.13 ± (69.00 - 69.26) ms70.11 ± (69.91 - 70.31) ms+1.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.78 ± (11.74 - 11.83) MB11.83 ± (11.81 - 11.86) MB+0.4%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)+0.0%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms187.96 ± (187.62 - 188.31) ms188.35 ± (188.07 - 188.64) ms+0.2%✅⬆️
process.time_to_main_ms70.42 ± (70.30 - 70.54) ms70.96 ± (70.80 - 71.11) ms+0.8%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.82 ± (11.79 - 11.85) MB11.87 ± (11.84 - 11.91) MB+0.5%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.2%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms364.26 ± (362.82 - 365.69) ms363.53 ± (362.21 - 364.86) ms-0.2%
process.time_to_main_ms433.43 ± (432.77 - 434.09) ms435.52 ± (434.77 - 436.27) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed48.10 ± (48.05 - 48.14) MB48.13 ± (48.08 - 48.17) MB+0.1%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.1%
Comparison explanation

Execution-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:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

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 charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8076) - mean (68ms)  : 67, 70
    master - mean (68ms)  : 67, 70

    section Bailout
    This PR (8076) - mean (72ms)  : 71, 73
    master - mean (72ms)  : 71, 73

    section CallTarget+Inlining+NGEN
    This PR (8076) - mean (1,022ms)  : 938, 1106
    master - mean (1,013ms)  : 943, 1082

Loading
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 (8076) - mean (106ms)  : 103, 108
    master - mean (106ms)  : 103, 108

    section Bailout
    This PR (8076) - mean (107ms)  : 106, 108
    master - mean (107ms)  : 105, 108

    section CallTarget+Inlining+NGEN
    This PR (8076) - mean (740ms)  : 685, 794
    master - mean (736ms)  : 685, 786

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8076) - mean (94ms)  : 92, 96
    master - mean (94ms)  : 92, 96

    section Bailout
    This PR (8076) - mean (95ms)  : 94, 96
    master - mean (94ms)  : 93, 95

    section CallTarget+Inlining+NGEN
    This PR (8076) - mean (718ms)  : 685, 752
    master - mean (715ms)  : 680, 750

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8076) - mean (92ms)  : 90, 94
    master - mean (92ms)  : 90, 95

    section Bailout
    This PR (8076) - mean (93ms)  : 92, 94
    master - mean (93ms)  : 92, 95

    section CallTarget+Inlining+NGEN
    This PR (8076) - mean (636ms)  : 617, 656
    master - mean (636ms)  : 622, 651

Loading
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 (8076) - mean (194ms)  : 189, 199
    master - mean (192ms)  : 188, 196

    section Bailout
    This PR (8076) - mean (200ms)  : 195, 205
    master - mean (195ms)  : 193, 198

    section CallTarget+Inlining+NGEN
    This PR (8076) - mean (1,139ms)  : 1066, 1211
    master - mean (1,124ms)  : 1053, 1195

Loading
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 (8076) - mean (276ms)  : 271, 281
    master - mean (275ms)  : 270, 280

    section Bailout
    This PR (8076) - mean (277ms)  : 272, 282
    master - mean (276ms)  : 271, 280

    section CallTarget+Inlining+NGEN
    This PR (8076) - mean (930ms)  : 889, 972
    master - mean (926ms)  : 880, 972

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8076) - mean (270ms)  : 264, 276
    master - mean (269ms)  : 264, 274

    section Bailout
    This PR (8076) - mean (271ms)  : 265, 277
    master - mean (268ms)  : 265, 272

    section CallTarget+Inlining+NGEN
    This PR (8076) - mean (914ms)  : 856, 973
    master - mean (916ms)  : 855, 976

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8076) - mean (270ms)  : 263, 277
    master - mean (268ms)  : 263, 272

    section Bailout
    This PR (8076) - mean (269ms)  : 264, 273
    master - mean (268ms)  : 263, 273

    section CallTarget+Inlining+NGEN
    This PR (8076) - mean (829ms)  : 814, 845
    master - mean (829ms)  : 811, 847

Loading

@gleocadie gleocadie marked this pull request as ready for review January 16, 2026 15:50
@gleocadie gleocadie requested a review from a team as a code owner January 16, 2026 15:50
@gleocadie gleocadie force-pushed the gleocadie/attempt-to-fix-crash-getappdomaininfo branch from bb0ae70 to d286b90 Compare January 19, 2026 08:40
Copy link
Contributor

@chrisnas chrisnas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gleocadie gleocadie merged commit 8d67a7b into master Jan 21, 2026
157 checks passed
@gleocadie gleocadie deleted the gleocadie/attempt-to-fix-crash-getappdomaininfo branch January 21, 2026 09:16
@github-actions github-actions bot added this to the vNext-v3 milestone Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:profiler Issues related to the continous-profiler identified-by:crashtracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants