-
Notifications
You must be signed in to change notification settings - Fork 141
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
Use a native logger for critical failures in the loader (#5929 -> v2) #5939
Conversation
## Summary of changes Wrap the call to the managed loader in a try/catch, and use a native logger to log the exception if any. ## Reason for change There's already a try/catch in the managed loader, but in some situations we can fail before even getting there (if jitting the method failed, for instance because of a trimmed runtime). Also, the managed loader logger can fail. ## Implementation details This PR adds a try/catch in the code emitted to load the managed loader. In the catch clause, we call a native logging function, with a direct unmanaged `calli` call to its address. Because we have now this outer catch block, I removed the `IsInSsi` logic which isn't needed anymore.
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.
👍
Datadog ReportBranch report: ✅ 0 Failed, 354339 Passed, 2540 Skipped, 24h 12m 11.72s 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 (5939) - mean (74ms) : 64, 84
. : milestone, 74,
section CallTarget+Inlining+NGEN
This PR (5939) - mean (1,027ms) : 1009, 1044
. : milestone, 1027,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5939) - mean (110ms) : 107, 113
. : milestone, 110,
section CallTarget+Inlining+NGEN
This PR (5939) - mean (709ms) : 684, 734
. : milestone, 709,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5939) - mean (94ms) : 91, 96
. : milestone, 94,
section CallTarget+Inlining+NGEN
This PR (5939) - mean (667ms) : 646, 689
. : milestone, 667,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5939) - mean (190ms) : 188, 193
. : milestone, 190,
section CallTarget+Inlining+NGEN
This PR (5939) - mean (1,115ms) : 1095, 1135
. : milestone, 1115,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5939) - mean (276ms) : 271, 281
. : milestone, 276,
section CallTarget+Inlining+NGEN
This PR (5939) - mean (877ms) : 857, 898
. : milestone, 877,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5939) - mean (266ms) : 260, 272
. : milestone, 266,
section CallTarget+Inlining+NGEN
This PR (5939) - mean (864ms) : 847, 881
. : milestone, 864,
|
Benchmarks Report for tracer 🐌Benchmarks for #5939 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‑netcoreapp3.1 | 1.190 | 559.95 | 666.25 | |
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 | 1.139 | 581.05 | 661.71 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 408ns | 0.917ns | 3.55ns | 0.00808 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 560ns | 0.289ns | 1.12ns | 0.00766 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 581ns | 0.615ns | 2.22ns | 0.0917 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 487ns | 0.474ns | 1.77ns | 0.00969 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 732ns | 0.497ns | 1.92ns | 0.00924 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 947ns | 2.16ns | 8.08ns | 0.104 | 0 | 0 | 658 B |
#5939 | StartFinishSpan |
net6.0 | 434ns | 0.567ns | 2.12ns | 0.00812 | 0 | 0 | 576 B |
#5939 | StartFinishSpan |
netcoreapp3.1 | 666ns | 0.45ns | 1.68ns | 0.00779 | 0 | 0 | 576 B |
#5939 | StartFinishSpan |
net472 | 662ns | 0.353ns | 1.37ns | 0.0916 | 0 | 0 | 578 B |
#5939 | StartFinishScope |
net6.0 | 532ns | 0.213ns | 0.796ns | 0.00967 | 0 | 0 | 696 B |
#5939 | StartFinishScope |
netcoreapp3.1 | 734ns | 0.701ns | 2.72ns | 0.00918 | 0 | 0 | 696 B |
#5939 | StartFinishScope |
net472 | 854ns | 0.447ns | 1.67ns | 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 | 674ns | 0.341ns | 1.32ns | 0.00973 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 958ns | 1.64ns | 6.13ns | 0.00948 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.14μs | 5.01ns | 19.4ns | 0.104 | 0 | 0 | 658 B |
#5939 | RunOnMethodBegin |
net6.0 | 661ns | 0.262ns | 1.02ns | 0.00978 | 0 | 0 | 696 B |
#5939 | RunOnMethodBegin |
netcoreapp3.1 | 900ns | 0.354ns | 1.37ns | 0.00956 | 0 | 0 | 696 B |
#5939 | RunOnMethodBegin |
net472 | 1.07μs | 0.958ns | 3.58ns | 0.104 | 0 | 0 | 658 B |
Summary of changes
Wrap the call to the managed loader in a try/catch, and use a native logger to log the exception if any.
Reason for change
There's already a try/catch in the managed loader, but in some situations we can fail before even getting there (if jitting the method failed, for instance because of a trimmed runtime). Also, the managed loader logger can fail.
Implementation details
This PR adds a try/catch in the code emitted to load the managed loader. In the catch clause, we call a native logging function, with a direct unmanaged
calli
call to its address.Because we have now this outer catch block, I removed the
IsInSsi
logic which isn't needed anymore.Other details
Backport of #5929