-
Notifications
You must be signed in to change notification settings - Fork 144
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
[ASM] iast: Fix for NullReferenceException in Stacktrace Walker #6326
[ASM] iast: Fix for NullReferenceException in Stacktrace Walker #6326
Conversation
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.
Thanks a lot
Datadog ReportBranch report: ✅ 0 Failed, 449857 Passed, 2732 Skipped, 19h 58m 18.04s 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 (6326) - mean (72ms) : 64, 80
. : milestone, 72,
master - mean (72ms) : 63, 81
. : milestone, 72,
section CallTarget+Inlining+NGEN
This PR (6326) - mean (1,107ms) : 1089, 1125
. : milestone, 1107,
master - mean (1,108ms) : 1088, 1129
. : milestone, 1108,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6326) - mean (109ms) : 106, 111
. : milestone, 109,
master - mean (108ms) : 106, 111
. : milestone, 108,
section CallTarget+Inlining+NGEN
This PR (6326) - mean (767ms) : 748, 787
. : milestone, 767,
master - mean (768ms) : 749, 787
. : milestone, 768,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6326) - mean (92ms) : 90, 94
. : milestone, 92,
master - mean (92ms) : 90, 93
. : milestone, 92,
section CallTarget+Inlining+NGEN
This PR (6326) - mean (718ms) : 703, 732
. : milestone, 718,
master - mean (723ms) : 707, 739
. : milestone, 723,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6326) - mean (191ms) : 186, 195
. : milestone, 191,
master - mean (191ms) : 184, 198
. : milestone, 191,
section CallTarget+Inlining+NGEN
This PR (6326) - mean (1,216ms) : 1192, 1239
. : milestone, 1216,
master - mean (1,211ms) : 1185, 1237
. : milestone, 1211,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6326) - mean (277ms) : 272, 282
. : milestone, 277,
master - mean (277ms) : 272, 281
. : milestone, 277,
section CallTarget+Inlining+NGEN
This PR (6326) - mean (944ms) : 928, 961
. : milestone, 944,
master - mean (948ms) : 926, 970
. : milestone, 948,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6326) - mean (266ms) : 263, 270
. : milestone, 266,
master - mean (265ms) : 261, 270
. : milestone, 265,
section CallTarget+Inlining+NGEN
This PR (6326) - mean (926ms) : 908, 944
. : milestone, 926,
master - mean (927ms) : 908, 945
. : milestone, 927,
|
Benchmarks Report for tracer 🐌Benchmarks for #6326 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 - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 | 1.125 | 1,350.71 | 1,200.83 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteAsync |
net6.0 | 1.35μs | 0.484ns | 1.88ns | 0.0135 | 0 | 0 | 952 B |
master | ExecuteAsync |
netcoreapp3.1 | 1.62μs | 0.915ns | 3.42ns | 0.0129 | 0 | 0 | 952 B |
master | ExecuteAsync |
net472 | 1.84μs | 0.611ns | 2.29ns | 0.145 | 0 | 0 | 915 B |
#6326 | ExecuteAsync |
net6.0 | 1.2μs | 0.42ns | 1.57ns | 0.0132 | 0 | 0 | 952 B |
#6326 | ExecuteAsync |
netcoreapp3.1 | 1.7μs | 0.773ns | 2.99ns | 0.0127 | 0 | 0 | 952 B |
#6326 | ExecuteAsync |
net472 | 1.83μs | 0.868ns | 3.36ns | 0.144 | 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.35μs | 1.56ns | 6.03ns | 0.033 | 0 | 0 | 2.31 KB |
master | SendAsync |
netcoreapp3.1 | 5.38μs | 3.21ns | 12.4ns | 0.0375 | 0 | 0 | 2.85 KB |
master | SendAsync |
net472 | 7.32μs | 2.05ns | 7.93ns | 0.493 | 0 | 0 | 3.12 KB |
#6326 | SendAsync |
net6.0 | 4.35μs | 1.92ns | 7.18ns | 0.0329 | 0 | 0 | 2.31 KB |
#6326 | SendAsync |
netcoreapp3.1 | 5.2μs | 4.69ns | 18.1ns | 0.037 | 0 | 0 | 2.85 KB |
#6326 | SendAsync |
net472 | 7.29μs | 1.98ns | 7.67ns | 0.493 | 0 | 0 | 3.12 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.59μs | 1.74ns | 6.76ns | 0.0225 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.28μs | 0.944ns | 3.53ns | 0.0216 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
net472 | 2.57μs | 1.54ns | 5.55ns | 0.25 | 0 | 0 | 1.57 KB |
#6326 | EnrichedLog |
net6.0 | 1.61μs | 0.904ns | 3.5ns | 0.0225 | 0 | 0 | 1.64 KB |
#6326 | EnrichedLog |
netcoreapp3.1 | 2.21μs | 0.744ns | 2.88ns | 0.0222 | 0 | 0 | 1.64 KB |
#6326 | EnrichedLog |
net472 | 2.6μs | 0.893ns | 3.22ns | 0.249 | 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 | 119μs | 163ns | 630ns | 0.0595 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
netcoreapp3.1 | 123μs | 273ns | 1.06μs | 0 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
net472 | 151μs | 215ns | 834ns | 0.682 | 0.227 | 0 | 4.46 KB |
#6326 | EnrichedLog |
net6.0 | 123μs | 150ns | 581ns | 0.0612 | 0 | 0 | 4.28 KB |
#6326 | EnrichedLog |
netcoreapp3.1 | 124μs | 140ns | 541ns | 0 | 0 | 0 | 4.28 KB |
#6326 | EnrichedLog |
net472 | 152μs | 198ns | 767ns | 0.684 | 0.228 | 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 | 3.07μs | 1.4ns | 5.24ns | 0.0299 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.09μs | 1.16ns | 4.35ns | 0.0286 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
net472 | 4.92μs | 2.69ns | 10.4ns | 0.32 | 0 | 0 | 2.02 KB |
#6326 | EnrichedLog |
net6.0 | 2.94μs | 0.795ns | 3.08ns | 0.031 | 0 | 0 | 2.2 KB |
#6326 | EnrichedLog |
netcoreapp3.1 | 4.08μs | 2.45ns | 9.5ns | 0.0286 | 0 | 0 | 2.2 KB |
#6326 | EnrichedLog |
net472 | 4.83μs | 1.11ns | 4.14ns | 0.319 | 0 | 0 | 2.02 KB |
Benchmarks.Trace.RedisBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6326
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0
1.138
1,458.89
1,282.38
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0 | 1.138 | 1,458.89 | 1,282.38 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendReceive |
net6.0 | 1.46μs | 0.875ns | 3.39ns | 0.016 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.8μs | 1.04ns | 4.03ns | 0.0152 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.13μs | 1.07ns | 3.85ns | 0.183 | 0 | 0 | 1.16 KB |
#6326 | SendReceive |
net6.0 | 1.28μs | 0.944ns | 3.53ns | 0.0161 | 0 | 0 | 1.14 KB |
#6326 | SendReceive |
netcoreapp3.1 | 1.73μs | 0.514ns | 1.92ns | 0.0156 | 0 | 0 | 1.14 KB |
#6326 | SendReceive |
net472 | 2.09μs | 1.55ns | 5.98ns | 0.183 | 0 | 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.66μs | 1.2ns | 4.65ns | 0.0226 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.78μs | 1.52ns | 5.67ns | 0.0227 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.29μs | 2.97ns | 11.5ns | 0.323 | 0 | 0 | 2.04 KB |
#6326 | EnrichedLog |
net6.0 | 2.79μs | 1.3ns | 5.04ns | 0.0222 | 0 | 0 | 1.6 KB |
#6326 | EnrichedLog |
netcoreapp3.1 | 3.83μs | 1.49ns | 5.76ns | 0.0212 | 0 | 0 | 1.65 KB |
#6326 | EnrichedLog |
net472 | 4.36μs | 2.79ns | 10.8ns | 0.324 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6326
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0
1.239
490.55
395.84
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0
1.143
553.29
483.97
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.239 | 490.55 | 395.84 | |
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 | 1.143 | 553.29 | 483.97 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 490ns | 1.16ns | 4.49ns | 0.00816 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 598ns | 0.944ns | 3.53ns | 0.0079 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 635ns | 1.16ns | 4.5ns | 0.0916 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 553ns | 0.346ns | 1.29ns | 0.00974 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 708ns | 0.648ns | 2.51ns | 0.0095 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 836ns | 1.26ns | 4.86ns | 0.104 | 0 | 0 | 658 B |
#6326 | StartFinishSpan |
net6.0 | 397ns | 0.639ns | 2.47ns | 0.008 | 0 | 0 | 576 B |
#6326 | StartFinishSpan |
netcoreapp3.1 | 571ns | 1.01ns | 3.9ns | 0.00769 | 0 | 0 | 576 B |
#6326 | StartFinishSpan |
net472 | 690ns | 1.84ns | 7.13ns | 0.0916 | 0 | 0 | 578 B |
#6326 | StartFinishScope |
net6.0 | 484ns | 0.373ns | 1.35ns | 0.00982 | 0 | 0 | 696 B |
#6326 | StartFinishScope |
netcoreapp3.1 | 663ns | 0.933ns | 3.61ns | 0.00931 | 0 | 0 | 696 B |
#6326 | StartFinishScope |
net472 | 787ns | 1.77ns | 6.85ns | 0.105 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6326
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0
1.212
723.96
597.45
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 | 1.212 | 723.96 | 597.45 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 724ns | 1.13ns | 4.39ns | 0.00982 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 920ns | 0.973ns | 3.64ns | 0.00926 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.09μs | 2.49ns | 9.66ns | 0.104 | 0 | 0 | 658 B |
#6326 | RunOnMethodBegin |
net6.0 | 598ns | 1.09ns | 4.23ns | 0.00965 | 0 | 0 | 696 B |
#6326 | RunOnMethodBegin |
netcoreapp3.1 | 887ns | 1.73ns | 6.69ns | 0.00931 | 0 | 0 | 696 B |
#6326 | RunOnMethodBegin |
net472 | 1.07μs | 1.39ns | 5.38ns | 0.104 | 0 | 0 | 658 B |
Benchmarks Report for appsec 🐌Benchmarks for #6326 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Iast.StringAspectsBenchmark - Faster 🎉 More allocations
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 | 1.183 | 61,300.00 | 51,800.00 | bimodal |
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 | 253.27 KB | 321.37 KB | 68.1 KB | 26.89% |
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 | 59.18 KB | 60.16 KB | 984 B | 1.66% |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StringConcatBenchmark |
net6.0 | 59.6μs | 589ns | 5.77μs | 0 | 0 | 0 | 43.44 KB |
master | StringConcatBenchmark |
netcoreapp3.1 | 58.1μs | 712ns | 6.94μs | 0 | 0 | 0 | 42.64 KB |
master | StringConcatBenchmark |
net472 | 37.7μs | 137ns | 514ns | 0 | 0 | 0 | 59.18 KB |
master | StringConcatAspectBenchmark |
net6.0 | 301μs | 1.7μs | 12.3μs | 0 | 0 | 0 | 253.27 KB |
master | StringConcatAspectBenchmark |
netcoreapp3.1 | 346μs | 1.45μs | 7.66μs | 0 | 0 | 0 | 253.8 KB |
master | StringConcatAspectBenchmark |
net472 | 291μs | 6.86μs | 67.6μs | 0 | 0 | 0 | 278.53 KB |
#6326 | StringConcatBenchmark |
net6.0 | 52μs | 228ns | 1.02μs | 0 | 0 | 0 | 43.44 KB |
#6326 | StringConcatBenchmark |
netcoreapp3.1 | 52.3μs | 220ns | 851ns | 0 | 0 | 0 | 42.64 KB |
#6326 | StringConcatBenchmark |
net472 | 37.9μs | 54.1ns | 187ns | 0 | 0 | 0 | 60.16 KB |
#6326 | StringConcatAspectBenchmark |
net6.0 | 311μs | 5.85μs | 57.3μs | 0 | 0 | 0 | 321.37 KB |
#6326 | StringConcatAspectBenchmark |
netcoreapp3.1 | 346μs | 2.82μs | 27.2μs | 0 | 0 | 0 | 254.08 KB |
#6326 | StringConcatAspectBenchmark |
net472 | 284μs | 6.07μs | 58.2μs | 0 | 0 | 0 | 278.53 KB |
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.
Thanks!
## Summary of changes In .NET Framework the `GetFrames()` method can return null. ## Reason for change Bug detected in telemetry ([Error Tracking case](https://app.datadoghq.com/error-tracking?query=service%3Ainstrumentation-telemetry-data%20%40lib_language%3Adotnet%20%40tracer_version%3A3.6.0.0&fromUser=false&issue_states=&issueId=4ddc4722-7f47-11ef-afd5-da7ad0900002&refresh_mode=sliding&source=all&view=spans&from_ts=1732196777908&to_ts=1732211177908&live=true)). ## Implementation details Create a null array when the method `GetFrames()` return null in .NET Framework.
Summary of changes
In .NET Framework the
GetFrames()
method can return null.Reason for change
Bug detected in telemetry (Error Tracking case).
Implementation details
Create a null array when the method
GetFrames()
return null in .NET Framework.