-
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
[Profiler] Prevent StackSamplerLoop
from crashing at shutdown
#6238
[Profiler] Prevent StackSamplerLoop
from crashing at shutdown
#6238
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.
LGTM
Datadog ReportBranch report: ✅ 0 Failed, 374718 Passed, 2420 Skipped, 16h 19m 46.43s 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 (6238) - mean (70ms) : 68, 71
. : milestone, 70,
master - mean (70ms) : 68, 71
. : milestone, 70,
section CallTarget+Inlining+NGEN
This PR (6238) - mean (1,119ms) : 1097, 1140
. : milestone, 1119,
master - mean (1,116ms) : 1099, 1133
. : milestone, 1116,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6238) - mean (109ms) : 106, 111
. : milestone, 109,
master - mean (108ms) : 106, 110
. : milestone, 108,
section CallTarget+Inlining+NGEN
This PR (6238) - mean (775ms) : 759, 790
. : milestone, 775,
master - mean (775ms) : 762, 787
. : milestone, 775,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6238) - mean (92ms) : 90, 93
. : milestone, 92,
master - mean (91ms) : 90, 93
. : milestone, 91,
section CallTarget+Inlining+NGEN
This PR (6238) - mean (734ms) : 716, 752
. : milestone, 734,
master - mean (731ms) : 716, 746
. : milestone, 731,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6238) - mean (189ms) : 186, 193
. : milestone, 189,
master - mean (191ms) : 185, 196
. : milestone, 191,
section CallTarget+Inlining+NGEN
This PR (6238) - mean (1,226ms) : 1204, 1248
. : milestone, 1226,
master - mean (1,229ms) : 1208, 1250
. : milestone, 1229,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6238) - mean (275ms) : 272, 278
. : milestone, 275,
master - mean (275ms) : 270, 280
. : milestone, 275,
section CallTarget+Inlining+NGEN
This PR (6238) - mean (953ms) : 938, 968
. : milestone, 953,
master - mean (949ms) : 934, 964
. : milestone, 949,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6238) - mean (264ms) : 260, 268
. : milestone, 264,
master - mean (264ms) : 260, 268
. : milestone, 264,
section CallTarget+Inlining+NGEN
This PR (6238) - mean (937ms) : 916, 958
. : milestone, 937,
master - mean (935ms) : 913, 957
. : milestone, 935,
|
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 (6238) (11.156M) : 0, 11156312
master (11.088M) : 0, 11088207
benchmarks/2.9.0 (11.033M) : 0, 11032866
section Automatic
This PR (6238) (7.346M) : 0, 7346481
master (7.158M) : 0, 7157708
benchmarks/2.9.0 (7.786M) : 0, 7785853
section Trace stats
master (7.480M) : 0, 7479543
section Manual
master (11.166M) : 0, 11165777
section Manual + Automatic
This PR (6238) (6.739M) : 0, 6739398
master (6.594M) : 0, 6593575
section DD_TRACE_ENABLED=0
master (10.250M) : 0, 10250493
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6238) (9.471M) : 0, 9471248
master (9.364M) : 0, 9363648
benchmarks/2.9.0 (9.495M) : 0, 9494821
section Automatic
This PR (6238) (6.475M) : 0, 6474963
master (6.450M) : 0, 6450198
section Trace stats
master (6.679M) : 0, 6679205
section Manual
master (9.587M) : 0, 9587094
section Manual + Automatic
This PR (6238) (5.913M) : 0, 5912859
master (6.057M) : 0, 6056858
section DD_TRACE_ENABLED=0
master (8.809M) : 0, 8809017
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6238) (9.834M) : 0, 9833743
master (9.954M) : 0, 9953951
benchmarks/2.9.0 (10.020M) : 0, 10019592
section Automatic
This PR (6238) (6.193M) : crit ,0, 6192849
master (6.558M) : 0, 6558012
benchmarks/2.9.0 (7.255M) : 0, 7255257
section Trace stats
master (7.152M) : 0, 7152123
section Manual
master (9.703M) : 0, 9703448
section Manual + Automatic
This PR (6238) (5.945M) : 0, 5944579
master (6.043M) : 0, 6042606
section DD_TRACE_ENABLED=0
master (9.169M) : 0, 9169184
|
Benchmarks Report for tracer 🐌Benchmarks for #6238 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 - Slower
|
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.377 | 400.08 | 550.77 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 401ns | 0.523ns | 2.03ns | 0.00812 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 552ns | 0.375ns | 1.35ns | 0.00762 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 727ns | 0.382ns | 1.48ns | 0.0916 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 541ns | 0.387ns | 1.5ns | 0.00988 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 683ns | 0.91ns | 3.53ns | 0.00955 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 868ns | 0.546ns | 2.11ns | 0.105 | 0 | 0 | 658 B |
#6238 | StartFinishSpan |
net6.0 | 551ns | 0.313ns | 1.21ns | 0.00798 | 0 | 0 | 576 B |
#6238 | StartFinishSpan |
netcoreapp3.1 | 590ns | 0.52ns | 2.01ns | 0.00777 | 0 | 0 | 576 B |
#6238 | StartFinishSpan |
net472 | 749ns | 0.451ns | 1.75ns | 0.0917 | 0 | 0 | 578 B |
#6238 | StartFinishScope |
net6.0 | 570ns | 0.382ns | 1.43ns | 0.00967 | 0 | 0 | 696 B |
#6238 | StartFinishScope |
netcoreapp3.1 | 719ns | 0.718ns | 2.78ns | 0.00927 | 0 | 0 | 696 B |
#6238 | StartFinishScope |
net472 | 904ns | 0.548ns | 2.12ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6238
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1
1.245
870.29
1,083.43
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1 | 1.245 | 870.29 | 1,083.43 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 642ns | 0.478ns | 1.85ns | 0.00974 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 868ns | 2.03ns | 7.86ns | 0.00906 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.08μs | 0.868ns | 3.36ns | 0.104 | 0 | 0 | 658 B |
#6238 | RunOnMethodBegin |
net6.0 | 583ns | 0.731ns | 2.83ns | 0.00972 | 0 | 0 | 696 B |
#6238 | RunOnMethodBegin |
netcoreapp3.1 | 1.08μs | 0.728ns | 2.82ns | 0.00957 | 0 | 0 | 696 B |
#6238 | RunOnMethodBegin |
net472 | 1.14μs | 1.12ns | 4.34ns | 0.104 | 0 | 0 | 658 B |
190dcc6
to
b22063a
Compare
b22063a
to
5255edb
Compare
5255edb
to
51e897a
Compare
Summary of changes
Make sure the
StackSamplerLoop
does not crash at shutdown.Reason for change
StackSamplerLoopManager
instance callsStop
on theStackSamplerLoop
instance. Which allows to finish and stop the thread.Then the
StackSamplerLoop
dtor is call (because the instance is destroyed), andStop
is called a second times. The thread object is not cleanup so not nullptr... so we calljoin
on a non-running thread (join
was called on the first call toStop
).This lead to a crash
Implementation details
_pThreadLoop
to another local variable (will set _pThreadLoop instance to nullptr)Test coverage
Since we inject the ICorprofilerInfo, it's difficult to make this a unit test. And the integration should catch it but.... never did...
Other details