-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Crashtracking] Fix the handling of COMPlus_DbgMiniDumpName #5980
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 360530 Passed, 2324 Skipped, 16h 44m 48.23s Total Time |
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing the following branches/commits: 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 shown 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). gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5980) - mean (70ms) : 66, 75
. : milestone, 70,
master - mean (69ms) : 67, 71
. : milestone, 69,
section CallTarget+Inlining+NGEN
This PR (5980) - mean (1,082ms) : 1052, 1113
. : milestone, 1082,
master - mean (1,077ms) : 1053, 1101
. : milestone, 1077,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5980) - mean (110ms) : 105, 114
. : milestone, 110,
master - mean (109ms) : 105, 112
. : milestone, 109,
section CallTarget+Inlining+NGEN
This PR (5980) - mean (759ms) : 737, 781
. : milestone, 759,
master - mean (758ms) : 739, 778
. : milestone, 758,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5980) - mean (93ms) : 89, 97
. : milestone, 93,
master - mean (92ms) : 90, 95
. : milestone, 92,
section CallTarget+Inlining+NGEN
This PR (5980) - mean (714ms) : 694, 735
. : milestone, 714,
master - mean (710ms) : 697, 724
. : milestone, 710,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5980) - mean (191ms) : 187, 195
. : milestone, 191,
master - mean (190ms) : 187, 192
. : milestone, 190,
section CallTarget+Inlining+NGEN
This PR (5980) - mean (1,165ms) : 1139, 1191
. : milestone, 1165,
master - mean (1,160ms) : 1137, 1184
. : milestone, 1160,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5980) - mean (277ms) : 270, 283
. : milestone, 277,
master - mean (274ms) : 270, 279
. : milestone, 274,
section CallTarget+Inlining+NGEN
This PR (5980) - mean (922ms) : 900, 945
. : milestone, 922,
master - mean (922ms) : 902, 942
. : milestone, 922,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5980) - mean (264ms) : 260, 268
. : milestone, 264,
master - mean (264ms) : 259, 268
. : milestone, 264,
section CallTarget+Inlining+NGEN
This PR (5980) - mean (899ms) : 880, 917
. : milestone, 899,
master - mean (902ms) : 883, 922
. : milestone, 902,
|
Benchmarks Report for tracer 🐌Benchmarks for #5980 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 | 1.133 | 1,334.86 | 1,178.60 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteNonQuery |
net6.0 | 1.34μs | 2.17ns | 8.42ns | 0.0147 | 0 | 0 | 1.02 KB |
master | ExecuteNonQuery |
netcoreapp3.1 | 1.73μs | 1.41ns | 5.09ns | 0.0139 | 0 | 0 | 1.02 KB |
master | ExecuteNonQuery |
net472 | 2.04μs | 2.09ns | 8.11ns | 0.156 | 0 | 0 | 987 B |
#5980 | ExecuteNonQuery |
net6.0 | 1.18μs | 1.2ns | 4.5ns | 0.0141 | 0 | 0 | 1.02 KB |
#5980 | ExecuteNonQuery |
netcoreapp3.1 | 1.84μs | 2.17ns | 8.42ns | 0.0134 | 0 | 0 | 1.02 KB |
#5980 | ExecuteNonQuery |
net472 | 2.13μs | 2.09ns | 8.09ns | 0.156 | 0 | 0 | 987 B |
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | CallElasticsearch |
net6.0 | 1.14μs | 1.16ns | 4.33ns | 0.0136 | 0 | 0 | 976 B |
master | CallElasticsearch |
netcoreapp3.1 | 1.54μs | 0.544ns | 1.96ns | 0.0131 | 0 | 0 | 976 B |
master | CallElasticsearch |
net472 | 2.5μs | 1.54ns | 5.77ns | 0.158 | 0 | 0 | 995 B |
master | CallElasticsearchAsync |
net6.0 | 1.24μs | 1.16ns | 4.48ns | 0.013 | 0 | 0 | 952 B |
master | CallElasticsearchAsync |
netcoreapp3.1 | 1.71μs | 0.784ns | 2.93ns | 0.0138 | 0 | 0 | 1.02 KB |
master | CallElasticsearchAsync |
net472 | 2.55μs | 1.12ns | 4.18ns | 0.166 | 0 | 0 | 1.05 KB |
#5980 | CallElasticsearch |
net6.0 | 1.18μs | 0.371ns | 1.39ns | 0.0136 | 0 | 0 | 976 B |
#5980 | CallElasticsearch |
netcoreapp3.1 | 1.61μs | 0.611ns | 2.28ns | 0.0135 | 0 | 0 | 976 B |
#5980 | CallElasticsearch |
net472 | 2.52μs | 3.32ns | 12.4ns | 0.157 | 0 | 0 | 995 B |
#5980 | CallElasticsearchAsync |
net6.0 | 1.21μs | 0.789ns | 2.95ns | 0.0134 | 0 | 0 | 952 B |
#5980 | CallElasticsearchAsync |
netcoreapp3.1 | 1.63μs | 0.716ns | 2.68ns | 0.0139 | 0 | 0 | 1.02 KB |
#5980 | CallElasticsearchAsync |
net472 | 2.54μs | 1.49ns | 5.75ns | 0.166 | 0 | 0 | 1.05 KB |
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteAsync |
net6.0 | 1.3μs | 0.772ns | 2.99ns | 0.0131 | 0 | 0 | 952 B |
master | ExecuteAsync |
netcoreapp3.1 | 1.71μs | 0.564ns | 2.11ns | 0.0128 | 0 | 0 | 952 B |
master | ExecuteAsync |
net472 | 1.72μs | 1.62ns | 6.27ns | 0.145 | 0 | 0 | 915 B |
#5980 | ExecuteAsync |
net6.0 | 1.19μs | 1.96ns | 7.6ns | 0.0131 | 0 | 0 | 952 B |
#5980 | ExecuteAsync |
netcoreapp3.1 | 1.63μs | 1.11ns | 4.15ns | 0.013 | 0 | 0 | 952 B |
#5980 | ExecuteAsync |
net472 | 1.74μs | 0.793ns | 2.97ns | 0.145 | 0 | 0 | 915 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendAsync |
net6.0 | 4.2μs | 1.06ns | 3.97ns | 0.0315 | 0 | 0 | 2.22 KB |
master | SendAsync |
netcoreapp3.1 | 5.11μs | 2.11ns | 7.9ns | 0.0384 | 0 | 0 | 2.76 KB |
master | SendAsync |
net472 | 7.74μs | 3.5ns | 12.1ns | 0.497 | 0 | 0 | 3.15 KB |
#5980 | SendAsync |
net6.0 | 4.23μs | 3ns | 11.6ns | 0.0298 | 0 | 0 | 2.22 KB |
#5980 | SendAsync |
netcoreapp3.1 | 5.13μs | 2.7ns | 10.1ns | 0.036 | 0 | 0 | 2.76 KB |
#5980 | SendAsync |
net472 | 7.8μs | 3.04ns | 11.8ns | 0.497 | 0 | 0 | 3.15 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 1.56μs | 0.729ns | 2.82ns | 0.0227 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.18μs | 1.06ns | 3.97ns | 0.0218 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
net472 | 2.7μs | 2.47ns | 8.91ns | 0.249 | 0 | 0 | 1.57 KB |
#5980 | EnrichedLog |
net6.0 | 1.57μs | 0.791ns | 2.96ns | 0.0228 | 0 | 0 | 1.64 KB |
#5980 | EnrichedLog |
netcoreapp3.1 | 2.16μs | 1.27ns | 4.91ns | 0.0215 | 0 | 0 | 1.64 KB |
#5980 | EnrichedLog |
net472 | 2.75μs | 2.25ns | 8.7ns | 0.25 | 0 | 0 | 1.57 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 120μs | 270ns | 1.04μs | 0.057 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
netcoreapp3.1 | 119μs | 283ns | 1.1μs | 0.0597 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
net472 | 147μs | 130ns | 503ns | 0.656 | 0.219 | 0 | 4.46 KB |
#5980 | EnrichedLog |
net6.0 | 113μs | 195ns | 755ns | 0 | 0 | 0 | 4.28 KB |
#5980 | EnrichedLog |
netcoreapp3.1 | 119μs | 299ns | 1.16μs | 0.0591 | 0 | 0 | 4.28 KB |
#5980 | EnrichedLog |
net472 | 149μs | 238ns | 922ns | 0.666 | 0.222 | 0 | 4.46 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 2.99μs | 1.1ns | 4.11ns | 0.03 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.13μs | 2.4ns | 9.29ns | 0.029 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
net472 | 4.95μs | 1.36ns | 5.27ns | 0.319 | 0 | 0 | 2.02 KB |
#5980 | EnrichedLog |
net6.0 | 2.93μs | 1.04ns | 3.88ns | 0.0309 | 0 | 0 | 2.2 KB |
#5980 | EnrichedLog |
netcoreapp3.1 | 4.02μs | 1.76ns | 6.81ns | 0.0301 | 0 | 0 | 2.2 KB |
#5980 | EnrichedLog |
net472 | 4.98μs | 1.12ns | 4.02ns | 0.321 | 0 | 0 | 2.02 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendReceive |
net6.0 | 1.45μs | 0.807ns | 3.13ns | 0.0159 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.85μs | 5.26ns | 20.4ns | 0.0157 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.22μs | 1.59ns | 6.16ns | 0.183 | 0.00111 | 0 | 1.16 KB |
#5980 | SendReceive |
net6.0 | 1.47μs | 1.06ns | 4.09ns | 0.0158 | 0 | 0 | 1.14 KB |
#5980 | SendReceive |
netcoreapp3.1 | 1.74μs | 0.718ns | 2.69ns | 0.0157 | 0 | 0 | 1.14 KB |
#5980 | SendReceive |
net472 | 2.15μs | 2.13ns | 7.95ns | 0.183 | 0.00107 | 0 | 1.16 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 2.81μs | 0.923ns | 3.58ns | 0.0225 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.82μs | 1.68ns | 6.49ns | 0.021 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.4μs | 1.84ns | 7.11ns | 0.323 | 0 | 0 | 2.04 KB |
#5980 | EnrichedLog |
net6.0 | 2.77μs | 1.92ns | 7.43ns | 0.0222 | 0 | 0 | 1.6 KB |
#5980 | EnrichedLog |
netcoreapp3.1 | 3.8μs | 2.37ns | 8.22ns | 0.021 | 0 | 0 | 1.65 KB |
#5980 | EnrichedLog |
net472 | 4.39μs | 1.26ns | 4.89ns | 0.323 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 430ns | 0.391ns | 1.46ns | 0.00794 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 557ns | 0.261ns | 1.01ns | 0.00779 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 621ns | 0.2ns | 0.749ns | 0.0916 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 532ns | 0.322ns | 1.25ns | 0.00984 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 660ns | 1.3ns | 5.05ns | 0.00948 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 850ns | 0.909ns | 3.52ns | 0.104 | 0 | 0 | 658 B |
#5980 | StartFinishSpan |
net6.0 | 399ns | 0.21ns | 0.813ns | 0.00806 | 0 | 0 | 576 B |
#5980 | StartFinishSpan |
netcoreapp3.1 | 613ns | 0.67ns | 2.59ns | 0.00771 | 0 | 0 | 576 B |
#5980 | StartFinishSpan |
net472 | 584ns | 0.524ns | 2.03ns | 0.0916 | 0 | 0 | 578 B |
#5980 | StartFinishScope |
net6.0 | 559ns | 0.227ns | 0.879ns | 0.00985 | 0 | 0 | 696 B |
#5980 | StartFinishScope |
netcoreapp3.1 | 721ns | 1.54ns | 5.98ns | 0.0093 | 0 | 0 | 696 B |
#5980 | StartFinishScope |
net472 | 860ns | 0.7ns | 2.62ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 602ns | 0.275ns | 1.07ns | 0.00972 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 898ns | 0.268ns | 1ns | 0.00945 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.06μs | 0.522ns | 2.02ns | 0.104 | 0 | 0 | 658 B |
#5980 | RunOnMethodBegin |
net6.0 | 662ns | 0.52ns | 2.01ns | 0.00987 | 0 | 0 | 696 B |
#5980 | RunOnMethodBegin |
netcoreapp3.1 | 931ns | 0.398ns | 1.54ns | 0.00919 | 0 | 0 | 696 B |
#5980 | RunOnMethodBegin |
net472 | 1.08μs | 1.04ns | 4.04ns | 0.104 | 0 | 0 | 658 B |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
8268acc
to
7173e8f
Compare
efdfdc4
to
2088be8
Compare
real_setenv(DD_INTERNAL_CRASHTRACKING_MINIDUMPNAME, originalMiniDumpName, 1); | ||
} | ||
setenv(COMPlus_DbgMiniDumpName, datadogCrashMarker, 1); | ||
setenv(DOTNET_DbgMiniDumpName, datadogCrashMarker, 1); | ||
|
||
real_setenv(COMPlus_DbgMiniDumpName, datadogCrashMarker, 1); | ||
real_setenv(DOTNET_DbgMiniDumpName, datadogCrashMarker, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a silly question, but is there a reason we have to clobber and restore the original values? Why can't we just store our marker in the DD_INTERNAL_ env instead?
## Summary of changes To distinguish the case when createdump is called because of a crash vs a call from `dotnet-dump`, we store a dummy value in `COMPlus_DbgMiniDumpName`: #5852 However, this becomes a problem when the process spawns a child process, as it inherits the dummy `COMPlus_DbgMiniDumpName` and we lose the original value. To get around that, this PR saves the original value in `DD_INTERNAL_CRASHTRACKING_MINIDUMPNAME` so the children can retrieve it. ## Reason for change This prevents the crash dump to be generated when launching the app from a bash script when `LD_PRELOAD` is set globally. ## Implementation details We discovered that bash provides its own version of the `getenv`/`setenv` functions, which leads to some unexpected behavior. To get around that, we use `dlsym` to fetch the original libc functions. ## Test coverage Added a test with a sample app launched from a bash script.
## Summary of changes To distinguish the case when createdump is called because of a crash vs a call from `dotnet-dump`, we store a dummy value in `COMPlus_DbgMiniDumpName`: #5852 However, this becomes a problem when the process spawns a child process, as it inherits the dummy `COMPlus_DbgMiniDumpName` and we lose the original value. To get around that, this PR saves the original value in `DD_INTERNAL_CRASHTRACKING_MINIDUMPNAME` so the children can retrieve it. ## Reason for change This prevents the crash dump to be generated when launching the app from a bash script when `LD_PRELOAD` is set globally. ## Implementation details We discovered that bash provides its own version of the `getenv`/`setenv` functions, which leads to some unexpected behavior. To get around that, we use `dlsym` to fetch the original libc functions. ## Test coverage Added a test with a sample app launched from a bash script.
… v2) (#6001) ## Summary of changes To distinguish the case when createdump is called because of a crash vs a call from `dotnet-dump`, we store a dummy value in `COMPlus_DbgMiniDumpName`: #5852 However, this becomes a problem when the process spawns a child process, as it inherits the dummy `COMPlus_DbgMiniDumpName` and we lose the original value. To get around that, this PR saves the original value in `DD_INTERNAL_CRASHTRACKING_MINIDUMPNAME` so the children can retrieve it. ## Reason for change This prevents the crash dump to be generated when launching the app from a bash script when `LD_PRELOAD` is set globally. ## Implementation details We discovered that bash provides its own version of the `getenv`/`setenv` functions, which leads to some unexpected behavior. To get around that, we use `dlsym` to fetch the original libc functions. ## Test coverage Added a test with a sample app launched from a bash script. ## Other details Backport of #5980 Co-authored-by: Kevin Gosse <kevin.gosse@datadoghq.com>
Summary of changes
To distinguish the case when createdump is called because of a crash vs a call from
dotnet-dump
, we store a dummy value inCOMPlus_DbgMiniDumpName
: #5852However, this becomes a problem when the process spawns a child process, as it inherits the dummy
COMPlus_DbgMiniDumpName
and we lose the original value.To get around that, this PR saves the original value in
DD_INTERNAL_CRASHTRACKING_MINIDUMPNAME
so the children can retrieve it.Reason for change
This prevents the crash dump to be generated when launching the app from a bash script when
LD_PRELOAD
is set globally.Implementation details
We discovered that bash provides its own version of the
getenv
/setenv
functions, which leads to some unexpected behavior. To get around that, we usedlsym
to fetch the original libc functions.Test coverage
Added a test with a sample app launched from a bash script.