Skip to content
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] Fix LinuxDlIteratePhdrDeadlock test #5963

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

gleocadie
Copy link
Collaborator

@gleocadie gleocadie commented Aug 30, 2024

Summary of changes

Fix LinuxDlIteratePhdrDeadlock test.

Reason for change

The test is randomly failing and not because there is a deadlock, but only because it's not correct. It uses the dlopen and dlclose from libdl.so library, instead of the ones we wrapped in the Datadog.Linux.ApiWrapper.x64.so file.

Implementation details

  • Use NativeLibrary.SetDllImportResolver to make sure we control how we want to resolve for our ApiWrapper library.

Test coverage

Other details

@gleocadie gleocadie requested a review from a team as a code owner August 30, 2024 01:34
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Aug 30, 2024

Datadog Report

Branch report: gleocadie/fix-dliteratephdr-tests
Commit report: b165d41
Test service: dd-trace-dotnet

✅ 0 Failed, 364230 Passed, 2340 Skipped, 15h 37m 11.21s Total Time
⌛ 1 Performance Regression

⌛ Performance Regressions vs Default Branch (1)

  • Profiler_allocation_cpu_walltime - scenarios 2.16s (+36.82ms, +2%) - Details

@andrewlock
Copy link
Member

andrewlock commented Aug 30, 2024

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:

  • 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).

@andrewlock
Copy link
Member

andrewlock commented Aug 30, 2024

Benchmarks Report for tracer 🐌

Benchmarks for #5963 compared to master:

  • 5 benchmarks are faster, with geometric mean 1.160
  • 2 benchmarks are slower, with geometric mean 1.149
  • All benchmarks have the same allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 7.77μs 43.4ns 282ns 0.0153 0.00763 0 5.43 KB
master StartStopWithChild netcoreapp3.1 10.1μs 52.4ns 273ns 0.0198 0.00989 0 5.62 KB
master StartStopWithChild net472 16.1μs 45.3ns 175ns 1.03 0.326 0.103 6.06 KB
#5963 StartStopWithChild net6.0 7.81μs 41.6ns 232ns 0.0114 0.0038 0 5.43 KB
#5963 StartStopWithChild netcoreapp3.1 9.58μs 51ns 284ns 0.0187 0.00467 0 5.62 KB
#5963 StartStopWithChild net472 16.1μs 51.4ns 199ns 1.03 0.304 0.0961 6.07 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 475μs 199ns 771ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 624μs 365ns 1.42μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 851μs 488ns 1.83μs 0.425 0 0 3.3 KB
#5963 WriteAndFlushEnrichedTraces net6.0 459μs 297ns 1.11μs 0 0 0 2.7 KB
#5963 WriteAndFlushEnrichedTraces netcoreapp3.1 623μs 254ns 985ns 0 0 0 2.7 KB
#5963 WriteAndFlushEnrichedTraces net472 833μs 411ns 1.54μs 0.417 0 0 3.3 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 186μs 1.07μs 7.68μs 0.183 0 0 18.45 KB
master SendRequest netcoreapp3.1 213μs 1.24μs 9.96μs 0.201 0 0 20.61 KB
master SendRequest net472 0.00408ns 0.000941ns 0.00352ns 0 0 0 0 b
#5963 SendRequest net6.0 192μs 1.07μs 7.03μs 0.183 0 0 18.45 KB
#5963 SendRequest netcoreapp3.1 206μs 814ns 3.15μs 0.207 0 0 20.61 KB
#5963 SendRequest net472 0.000184ns 0.000184ns 0.000689ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 549μs 1.54μs 5.75μs 0.553 0 0 41.61 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 670μs 3.15μs 13.7μs 0.326 0 0 41.78 KB
master WriteAndFlushEnrichedTraces net472 866μs 3.95μs 15.3μs 8.36 2.64 0.44 53.29 KB
#5963 WriteAndFlushEnrichedTraces net6.0 551μs 2.44μs 9.14μs 0.561 0 0 41.55 KB
#5963 WriteAndFlushEnrichedTraces netcoreapp3.1 687μs 1.9μs 6.59μs 0.338 0 0 41.9 KB
#5963 WriteAndFlushEnrichedTraces net472 862μs 4.17μs 18.2μs 8.25 2.6 0.434 53.32 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.34μs 0.951ns 3.68ns 0.0141 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.61μs 1.24ns 4.81ns 0.0131 0 0 1.02 KB
master ExecuteNonQuery net472 2.03μs 2.26ns 8.74ns 0.157 0 0 987 B
#5963 ExecuteNonQuery net6.0 1.24μs 1.06ns 4.09ns 0.014 0 0 1.02 KB
#5963 ExecuteNonQuery netcoreapp3.1 1.79μs 1.49ns 5.77ns 0.0135 0 0 1.02 KB
#5963 ExecuteNonQuery net472 2.06μs 4.01ns 15ns 0.156 0 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #5963

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 1.133 1,361.76 1,202.19

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.21μs 0.821ns 3.18ns 0.0139 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.49μs 1.44ns 5.56ns 0.0134 0 0 976 B
master CallElasticsearch net472 2.5μs 1.25ns 4.86ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.36μs 0.94ns 3.64ns 0.0136 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.6μs 0.256ns 0.924ns 0.0137 0 0 1.02 KB
master CallElasticsearchAsync net472 2.5μs 1.95ns 7.56ns 0.166 0.00125 0 1.05 KB
#5963 CallElasticsearch net6.0 1.14μs 0.666ns 2.58ns 0.0138 0 0 976 B
#5963 CallElasticsearch netcoreapp3.1 1.56μs 0.835ns 3.23ns 0.0132 0 0 976 B
#5963 CallElasticsearch net472 2.52μs 2.47ns 9.55ns 0.157 0 0 995 B
#5963 CallElasticsearchAsync net6.0 1.2μs 0.434ns 1.62ns 0.0133 0 0 952 B
#5963 CallElasticsearchAsync netcoreapp3.1 1.59μs 0.88ns 3.29ns 0.0134 0 0 1.02 KB
#5963 CallElasticsearchAsync net472 2.61μs 1.97ns 7.63ns 0.166 0 0 1.05 KB
Benchmarks.Trace.GraphQLBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #5963

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 1.168 1,177.64 1,375.20

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.18μs 1.12ns 4.33ns 0.0129 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.56μs 1.35ns 4.87ns 0.0124 0 0 952 B
master ExecuteAsync net472 1.75μs 1.41ns 5.47ns 0.145 0 0 915 B
#5963 ExecuteAsync net6.0 1.38μs 1.2ns 4.47ns 0.0131 0 0 952 B
#5963 ExecuteAsync netcoreapp3.1 1.59μs 2.84ns 11ns 0.0127 0 0 952 B
#5963 ExecuteAsync net472 1.79μs 1.64ns 6.34ns 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 18ns 67.5ns 0.0304 0 0 2.22 KB
master SendAsync netcoreapp3.1 5.12μs 3.12ns 12.1ns 0.036 0 0 2.76 KB
master SendAsync net472 7.94μs 6.26ns 24.2ns 0.5 0 0 3.15 KB
#5963 SendAsync net6.0 4.42μs 2.03ns 7.6ns 0.0307 0 0 2.22 KB
#5963 SendAsync netcoreapp3.1 5.04μs 1.85ns 7.18ns 0.038 0 0 2.76 KB
#5963 SendAsync net472 7.81μs 19.5ns 75.6ns 0.498 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.52μs 0.61ns 2.36ns 0.0236 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.23μs 1.4ns 5.06ns 0.0222 0 0 1.64 KB
master EnrichedLog net472 2.69μs 2.15ns 8.06ns 0.249 0 0 1.57 KB
#5963 EnrichedLog net6.0 1.58μs 0.827ns 3.09ns 0.0229 0 0 1.64 KB
#5963 EnrichedLog netcoreapp3.1 2.15μs 0.787ns 2.95ns 0.0218 0 0 1.64 KB
#5963 EnrichedLog net472 2.76μs 1.55ns 5.81ns 0.248 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 118μs 163ns 630ns 0.059 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 120μs 162ns 629ns 0.0598 0 0 4.28 KB
master EnrichedLog net472 150μs 150ns 583ns 0.674 0.225 0 4.46 KB
#5963 EnrichedLog net6.0 118μs 229ns 887ns 0.0584 0 0 4.28 KB
#5963 EnrichedLog netcoreapp3.1 120μs 195ns 755ns 0.059 0 0 4.28 KB
#5963 EnrichedLog net472 148μs 348ns 1.35μs 0.658 0.219 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.18μs 0.988ns 3.7ns 0.0303 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.24μs 1.35ns 5.23ns 0.0298 0 0 2.2 KB
master EnrichedLog net472 4.89μs 1.76ns 6.59ns 0.319 0 0 2.02 KB
#5963 EnrichedLog net6.0 3μs 1.39ns 5.37ns 0.0315 0 0 2.2 KB
#5963 EnrichedLog netcoreapp3.1 4.24μs 2.32ns 8.69ns 0.0296 0 0 2.2 KB
#5963 EnrichedLog net472 4.89μs 1.31ns 4.89ns 0.319 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.26μs 0.93ns 3.6ns 0.0158 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.75μs 1.23ns 4.75ns 0.0149 0 0 1.14 KB
master SendReceive net472 2.23μs 0.856ns 3.32ns 0.184 0.00113 0 1.16 KB
#5963 SendReceive net6.0 1.29μs 0.979ns 3.66ns 0.0162 0 0 1.14 KB
#5963 SendReceive netcoreapp3.1 1.84μs 0.741ns 2.67ns 0.0147 0 0 1.14 KB
#5963 SendReceive net472 2.15μs 1.97ns 7.64ns 0.184 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.82μs 1.12ns 4.04ns 0.0225 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.72μs 1.25ns 4.66ns 0.0224 0 0 1.65 KB
master EnrichedLog net472 4.2μs 3.55ns 13.8ns 0.324 0 0 2.04 KB
#5963 EnrichedLog net6.0 2.65μs 0.96ns 3.72ns 0.0226 0 0 1.6 KB
#5963 EnrichedLog netcoreapp3.1 3.96μs 0.833ns 3.12ns 0.0218 0 0 1.65 KB
#5963 EnrichedLog net472 4.25μs 1.63ns 6.12ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #5963

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.232 509.46 413.60
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 1.170 697.28 595.90
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 1.145 749.58 654.87

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 509ns 0.43ns 1.67ns 0.00812 0 0 576 B
master StartFinishSpan netcoreapp3.1 588ns 0.641ns 2.4ns 0.00765 0 0 576 B
master StartFinishSpan net472 698ns 0.529ns 2.05ns 0.0917 0 0 578 B
master StartFinishScope net6.0 470ns 0.343ns 1.33ns 0.00971 0 0 696 B
master StartFinishScope netcoreapp3.1 750ns 0.404ns 1.57ns 0.00927 0 0 696 B
master StartFinishScope net472 819ns 1.51ns 5.84ns 0.104 0 0 658 B
#5963 StartFinishSpan net6.0 414ns 0.366ns 1.42ns 0.00807 0 0 576 B
#5963 StartFinishSpan netcoreapp3.1 586ns 0.33ns 1.23ns 0.00791 0 0 576 B
#5963 StartFinishSpan net472 596ns 1.2ns 4.63ns 0.0917 0 0 578 B
#5963 StartFinishScope net6.0 477ns 0.432ns 1.67ns 0.00976 0 0 696 B
#5963 StartFinishScope netcoreapp3.1 654ns 0.548ns 2.05ns 0.00947 0 0 696 B
#5963 StartFinishScope net472 812ns 0.539ns 2.09ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #5963

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.131 637.70 721.14

Faster 🎉 in #5963

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1 1.124 1,007.94 896.52

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 638ns 0.46ns 1.78ns 0.00997 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.01μs 1.65ns 6.39ns 0.00964 0 0 696 B
master RunOnMethodBegin net472 1.01μs 1.12ns 4.34ns 0.104 0 0 658 B
#5963 RunOnMethodBegin net6.0 721ns 0.489ns 1.89ns 0.00979 0 0 696 B
#5963 RunOnMethodBegin netcoreapp3.1 894ns 2.39ns 8.96ns 0.00967 0 0 696 B
#5963 RunOnMethodBegin net472 1.01μs 0.87ns 3.37ns 0.104 0 0 658 B

@gleocadie gleocadie force-pushed the gleocadie/fix-dliteratephdr-tests branch from dce2c3f to b165d41 Compare August 30, 2024 02:28
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 6156310 into master Aug 30, 2024
73 of 77 checks passed
@gleocadie gleocadie deleted the gleocadie/fix-dliteratephdr-tests branch August 30, 2024 08:21
@github-actions github-actions bot added this to the vNext-v3 milestone Aug 30, 2024
@andrewlock andrewlock added the area:tests unit tests, integration tests label Sep 2, 2024
@andrewlock andrewlock added area:profiler Issues related to the continous-profiler area:profiler labels Sep 16, 2024
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 area:tests unit tests, integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants