[Profiler] Prevent profiler from interrupted thread while executing handler SIGSEGV handler#8465
Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8465) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-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 highlighted 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). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8465) - mean (72ms) : 69, 75
master - mean (75ms) : 70, 80
section Bailout
This PR (8465) - mean (76ms) : 74, 79
master - mean (78ms) : 74, 82
section CallTarget+Inlining+NGEN
This PR (8465) - mean (1,080ms) : 1022, 1138
master - mean (1,075ms) : 1023, 1127
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8465) - mean (114ms) : 108, 119
master - mean (116ms) : 110, 122
section Bailout
This PR (8465) - mean (114ms) : 111, 116
master - mean (114ms) : 111, 118
section CallTarget+Inlining+NGEN
This PR (8465) - mean (801ms) : 765, 837
master - mean (792ms) : 763, 821
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8465) - mean (99ms) : 96, 103
master - mean (103ms) : 97, 108
section Bailout
This PR (8465) - mean (104ms) : 97, 111
master - mean (100ms) : 98, 103
section CallTarget+Inlining+NGEN
This PR (8465) - mean (941ms) : 900, 982
master - mean (938ms) : 904, 972
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8465) - mean (102ms) : 96, 107
master - mean (99ms) : 96, 102
section Bailout
This PR (8465) - mean (101ms) : 99, 104
master - mean (103ms) : 96, 110
section CallTarget+Inlining+NGEN
This PR (8465) - mean (829ms) : 796, 862
master - mean (822ms) : 787, 857
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8465) - mean (201ms) : 194, 207
master - mean (199ms) : 194, 205
section Bailout
This PR (8465) - mean (204ms) : 201, 208
master - mean (203ms) : 198, 208
section CallTarget+Inlining+NGEN
This PR (8465) - mean (1,185ms) : 1140, 1231
master - mean (1,186ms) : 1131, 1242
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8465) - mean (288ms) : 282, 295
master - mean (288ms) : 282, 295
section Bailout
This PR (8465) - mean (291ms) : 286, 296
master - mean (289ms) : 282, 295
section CallTarget+Inlining+NGEN
This PR (8465) - mean (963ms) : 940, 986
master - mean (963ms) : 939, 987
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8465) - mean (284ms) : 278, 289
master - mean (281ms) : 274, 289
section Bailout
This PR (8465) - mean (285ms) : 278, 292
master - mean (281ms) : 276, 287
section CallTarget+Inlining+NGEN
This PR (8465) - mean (1,154ms) : 1104, 1203
master - mean (1,151ms) : 1107, 1195
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8465) - mean (280ms) : 271, 289
master - mean (282ms) : 275, 290
section Bailout
This PR (8465) - mean (283ms) : 278, 288
master - mean (281ms) : 274, 288
section CallTarget+Inlining+NGEN
This PR (8465) - mean (1,047ms) : 1003, 1091
master - mean (1,042ms) : 994, 1089
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
`SIGSEGV` handler
3641bf5 to
6bcc4dc
Compare
BenchmarksBenchmark execution time: 2026-04-17 09:41:36 Comparing candidate commit 6bcc4dc in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 27 metrics, 0 unstable metrics, 87 known flaky benchmarks.
|
Summary of changes
This PR is inspired from #8162
Reason for change
There is a stack overflow on the altstack when coreclr's
SIGSEGVhandler is interrupted bySIGPROFsignal.Here is the trace from kernel (obtained with this vibecoded ebpf tracer https://github.com/korniltsev-grafanista/signalsnoop ):
Details
Implementation details
This PR adds wrappers to
sigactionandpthread_sigmask.sigactionmasksSIGPROFif the signal isSIGSEGV- to prevent SIGSEGV stack overflow during signal delivering.pthread_sigmaskunblocksSIGPROFif we are unblockingSIGSEGV- the runtime unblocks SIGSEGV, and we should unblockSIGPROFas well to allow the profiler continue working and deliveringSIGPROFsignals.Test coverage
This is the code I used to simplify reproducing - triggering null deref in managed code in a busy loop. https://github.com/grafana/pyroscope-dotnet/pull/177/files#diff-75c68efd0775648bc723a9557e3cc83a294c79852dc5dc2c733e8bb80e15a9fcR18
Other details
Disclaimer: the problem was initially reported by grafana user(using the fork https://github.com/grafana/pyroscope-dotnet) we then confirmed the same problem with the genuine (not fork) dd-trace-dotnet v0.34.0.