[ASM] Extend locking to cover _disposed member variable#6319
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 451293 Passed, 2743 Skipped, 20h 42m 41.67s Total Time New Flaky Tests (1)
⌛ Performance Regressions vs Default Branch (1)
|
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 (6319) - mean (69ms) : 65, 73
. : milestone, 69,
master - mean (69ms) : 66, 71
. : milestone, 69,
section CallTarget+Inlining+NGEN
This PR (6319) - mean (983ms) : 943, 1022
. : milestone, 983,
master - mean (979ms) : 960, 998
. : milestone, 979,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6319) - mean (108ms) : 105, 110
. : milestone, 108,
master - mean (108ms) : 106, 110
. : milestone, 108,
section CallTarget+Inlining+NGEN
This PR (6319) - mean (682ms) : 664, 700
. : milestone, 682,
master - mean (680ms) : 666, 694
. : milestone, 680,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6319) - mean (91ms) : 90, 93
. : milestone, 91,
master - mean (91ms) : 89, 93
. : milestone, 91,
section CallTarget+Inlining+NGEN
This PR (6319) - mean (633ms) : 617, 649
. : milestone, 633,
master - mean (633ms) : 617, 649
. : milestone, 633,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6319) - mean (191ms) : 186, 196
. : milestone, 191,
master - mean (190ms) : 186, 195
. : milestone, 190,
section CallTarget+Inlining+NGEN
This PR (6319) - mean (1,092ms) : 1064, 1121
. : milestone, 1092,
master - mean (1,093ms) : 1066, 1121
. : milestone, 1093,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6319) - mean (276ms) : 272, 280
. : milestone, 276,
master - mean (278ms) : 273, 282
. : milestone, 278,
section CallTarget+Inlining+NGEN
This PR (6319) - mean (875ms) : 840, 910
. : milestone, 875,
master - mean (879ms) : 850, 908
. : milestone, 879,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6319) - mean (266ms) : 262, 270
. : milestone, 266,
master - mean (269ms) : 264, 273
. : milestone, 269,
section CallTarget+Inlining+NGEN
This PR (6319) - mean (857ms) : 824, 890
. : milestone, 857,
master - mean (859ms) : 829, 890
. : milestone, 859,
|
Throughput/Crank Report ⚡Throughput results for AspNetCoreSimpleController comparing the following branches/commits: Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red. Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards! gantt
title Throughput Linux x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6319) (11.331M) : 0, 11330881
master (11.117M) : 0, 11116942
benchmarks/2.9.0 (11.033M) : 0, 11032866
section Automatic
This PR (6319) (7.237M) : 0, 7237407
master (7.260M) : 0, 7259731
benchmarks/2.9.0 (7.786M) : 0, 7785853
section Trace stats
master (7.668M) : 0, 7667598
section Manual
master (11.257M) : 0, 11257422
section Manual + Automatic
This PR (6319) (6.760M) : 0, 6760316
master (6.752M) : 0, 6751591
section DD_TRACE_ENABLED=0
master (10.429M) : 0, 10429279
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6319) (9.726M) : 0, 9725905
master (9.664M) : 0, 9663866
benchmarks/2.9.0 (9.495M) : 0, 9494821
section Automatic
This PR (6319) (6.475M) : 0, 6475202
master (6.467M) : 0, 6466720
section Trace stats
master (6.704M) : 0, 6704260
section Manual
master (9.711M) : 0, 9710712
section Manual + Automatic
This PR (6319) (5.848M) : 0, 5847583
master (5.991M) : 0, 5991245
section DD_TRACE_ENABLED=0
master (8.961M) : 0, 8961362
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6319) (9.603M) : 0, 9602849
master (10.283M) : 0, 10282578
benchmarks/2.9.0 (10.020M) : 0, 10019592
section Automatic
This PR (6319) (6.229M) : crit ,0, 6229125
master (6.605M) : 0, 6605152
benchmarks/2.9.0 (7.255M) : 0, 7255257
section Trace stats
master (7.186M) : 0, 7186132
section Manual
master (10.025M) : 0, 10025447
section Manual + Automatic
This PR (6319) (6.011M) : 0, 6011246
master (6.195M) : 0, 6194775
section DD_TRACE_ENABLED=0
master (9.464M) : 0, 9463946
|
Benchmarks Report for tracer 🐌Benchmarks for #6319 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 - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
|
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.139 | 458.08 | 402.30 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net6.0 | 458ns | 0.228ns | 0.883ns | 0.00802 | 0 | 0 | 576 B |
| master | StartFinishSpan |
netcoreapp3.1 | 572ns | 0.241ns | 0.934ns | 0.0078 | 0 | 0 | 576 B |
| master | StartFinishSpan |
net472 | 737ns | 0.746ns | 2.89ns | 0.0917 | 0 | 0 | 578 B |
| master | StartFinishScope |
net6.0 | 562ns | 0.786ns | 3.04ns | 0.00967 | 0 | 0 | 696 B |
| master | StartFinishScope |
netcoreapp3.1 | 740ns | 0.373ns | 1.44ns | 0.00927 | 0 | 0 | 696 B |
| master | StartFinishScope |
net472 | 879ns | 1.34ns | 5.18ns | 0.104 | 0 | 0 | 658 B |
| #6319 | StartFinishSpan |
net6.0 | 402ns | 0.228ns | 0.883ns | 0.00797 | 0 | 0 | 576 B |
| #6319 | StartFinishSpan |
netcoreapp3.1 | 594ns | 0.38ns | 1.42ns | 0.00775 | 0 | 0 | 576 B |
| #6319 | StartFinishSpan |
net472 | 672ns | 0.384ns | 1.49ns | 0.0916 | 0 | 0 | 578 B |
| #6319 | StartFinishScope |
net6.0 | 558ns | 0.297ns | 1.15ns | 0.00979 | 0 | 0 | 696 B |
| #6319 | StartFinishScope |
netcoreapp3.1 | 801ns | 0.509ns | 1.97ns | 0.00933 | 0 | 0 | 696 B |
| #6319 | StartFinishScope |
net472 | 850ns | 0.429ns | 1.61ns | 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 | 693ns | 0.626ns | 2.43ns | 0.00977 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 878ns | 0.466ns | 1.74ns | 0.00925 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
net472 | 1.15μs | 1.32ns | 4.77ns | 0.104 | 0 | 0 | 658 B |
| #6319 | RunOnMethodBegin |
net6.0 | 681ns | 0.418ns | 1.62ns | 0.00965 | 0 | 0 | 696 B |
| #6319 | RunOnMethodBegin |
netcoreapp3.1 | 899ns | 0.548ns | 2.05ns | 0.00952 | 0 | 0 | 696 B |
| #6319 | RunOnMethodBegin |
net472 | 1.15μs | 0.873ns | 3.38ns | 0.104 | 0 | 0 | 658 B |
a2f8567 to
ec59707
Compare
Benchmarks Report for appsec 🐌Benchmarks for #6319 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 - Same speed ✔️ More allocations
|
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 | 59.33 KB | 59.65 KB | 320 B | 0.54% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StringConcatBenchmark |
net6.0 | 60.3μs | 686ns | 6.62μs | 0 | 0 | 0 | 43.44 KB |
| master | StringConcatBenchmark |
netcoreapp3.1 | 62.7μs | 863ns | 8.36μs | 0 | 0 | 0 | 42.64 KB |
| master | StringConcatBenchmark |
net472 | 37.9μs | 105ns | 363ns | 0 | 0 | 0 | 59.33 KB |
| master | StringConcatAspectBenchmark |
net6.0 | 298μs | 4.98μs | 48.3μs | 0 | 0 | 0 | 255.16 KB |
| master | StringConcatAspectBenchmark |
netcoreapp3.1 | 345μs | 1.97μs | 14.8μs | 0 | 0 | 0 | 253.82 KB |
| master | StringConcatAspectBenchmark |
net472 | 289μs | 6.11μs | 59.5μs | 0 | 0 | 0 | 278.53 KB |
| #6319 | StringConcatBenchmark |
net6.0 | 62.2μs | 990ns | 9.85μs | 0 | 0 | 0 | 43.44 KB |
| #6319 | StringConcatBenchmark |
netcoreapp3.1 | 63.4μs | 744ns | 7.17μs | 0 | 0 | 0 | 42.64 KB |
| #6319 | StringConcatBenchmark |
net472 | 38.2μs | 83.3ns | 300ns | 0 | 0 | 0 | 59.65 KB |
| #6319 | StringConcatAspectBenchmark |
net6.0 | 309μs | 1.67μs | 8.86μs | 0 | 0 | 0 | 254.93 KB |
| #6319 | StringConcatAspectBenchmark |
netcoreapp3.1 | 352μs | 1.8μs | 9.83μs | 0 | 0 | 0 | 254.46 KB |
| #6319 | StringConcatAspectBenchmark |
net472 | 292μs | 5.79μs | 56.1μs | 0 | 0 | 0 | 278.53 KB |
## Summary of changes We have seen that some clients experience crashes that seem to be caused to concurrent access to members within the WAF. As the WAF does not implemented any locking, it's client code of the WAF that should ensure there's no incorrect concurrent access to the WAF. ## Test coverage Added a unit test that tests concurrent access to the context and fails before this changes is implemented.
Summary of changes
We have seen that some clients experience crashes that seem to be caused to concurrent access to members within the WAF. As the WAF does not implemented any locking, it's client code of the WAF that should ensure there's no incorrect concurrent access to the WAF.
Test coverage
Added a unit test that tests concurrent access to the context and fails before this changes is implemented.