Skip to content

[Debugger Tests] Surface sample exit diagnostics during /stop cleanup#8571

Merged
dudikeleti merged 2 commits into
masterfrom
dudik/debugger-sample-helper-surface-exit
May 11, 2026
Merged

[Debugger Tests] Surface sample exit diagnostics during /stop cleanup#8571
dudikeleti merged 2 commits into
masterfrom
dudik/debugger-sample-helper-surface-exit

Conversation

@dudikeleti

@dudikeleti dudikeleti commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

  • DebuggerSampleProcessHelper.StopSample now surfaces the actual sample-process exit code, stdout, and stderr when the process exits before or during the /stop HTTP call.
  • Pre-checks Process.HasExited before issuing /stop, then uses ExitCodeException.ThrowIfNonZero so crashes fail with the real process exit information.
  • Handles /stop transport failures caused by HttpRequestException or SocketException; if the process exited mid-request, the same diagnostics are logged and the exit code is surfaced.
  • Adds focused coverage for the already-exited non-zero sample-process path.

Reason for change

  • When a debugger sample crashes, the test can currently fail with a generic connection error from /stop, hiding the real exit code and sample output.
  • Surfacing the process diagnostics makes native crashes and managed throws in debugger integration tests much faster to triage.

Implementation details

  • Test-only helper change. No production code changes.
  • The exception filter is intentionally narrow: only transport-style /stop failures are translated, and only when the process has exited.
  • Other failures, such as timeouts or failures while the process is still alive, continue to be rethrown unchanged.

Test coverage

  • Added DebuggerSampleProcessHelperTests.StopSample_WhenProcessAlreadyExitedWithNonZeroExitCode_SurfacesExitDetails.

@dudikeleti
dudikeleti requested a review from a team as a code owner May 6, 2026 10:05
@github-actions github-actions Bot added area:tests unit tests, integration tests area:debugger labels May 6, 2026
@dudikeleti
dudikeleti marked this pull request as draft May 6, 2026 10:31
@pr-commenter

pr-commenter Bot commented May 6, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-05-06 15:27:43

Comparing candidate commit 5661419 in PR branch dudik/debugger-sample-helper-surface-exit with baseline commit 1e6fec9 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 27 metrics, 0 unstable metrics, 64 known flaky benchmarks, 23 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-10379.860op/s; -9652.187op/s] or [-12.307%; -11.445%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟥 throughput [-6114.280op/s; -4985.397op/s] or [-6.217%; -5.069%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+323.092ms; +324.532ms] or [+160.330%; +161.044%]
  • 🟥 throughput [-39.803op/s; -36.252op/s] or [-7.161%; -6.522%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+380.022ms; +381.181ms] or [+300.241%; +301.156%]
  • 🟩 throughput [+90.813op/s; +95.809op/s] or [+11.973%; +12.632%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+395.344ms; +398.309ms] or [+349.865%; +352.488%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.529%; +27.541%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.977%; +9.987%]
  • 🟩 execution_time [-16.028ms; -11.852ms] or [-7.485%; -5.535%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+27.502%; +27.510%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.746%; +105.759%]
  • 🟥 throughput [-261991.096op/s; -258317.136op/s] or [-26.751%; -26.375%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.558%; +38.566%]
  • 🟩 execution_time [-26.943ms; -18.013ms] or [-12.015%; -8.033%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.292%; +105.304%]
  • 🟥 throughput [-136685.625op/s; -120748.599op/s] or [-19.639%; -17.349%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟩 throughput [+9454.011op/s; +12449.505op/s] or [+6.015%; +7.921%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟩 throughput [+11445.442op/s; +14113.388op/s] or [+9.118%; +11.243%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+445751.339op/s; +467356.154op/s] or [+14.863%; +15.584%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-18.073ms; -13.555ms] or [-8.331%; -6.248%]
  • 🟩 throughput [+160086.693op/s; +216355.043op/s] or [+6.354%; +8.588%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟥 execution_time [+299.815ms; +300.371ms] or [+149.807%; +150.085%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟥 execution_time [+299.723ms; +302.873ms] or [+151.151%; +152.740%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟥 execution_time [+299.277ms; +301.704ms] or [+150.752%; +151.975%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+298.257ms; +299.536ms] or [+146.492%; +147.120%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+293.339ms; +294.692ms] or [+143.402%; +144.064%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+300.962ms; +302.563ms] or [+150.421%; +151.221%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0

  • 🟥 execution_time [+31.866µs; +58.695µs] or [+7.309%; +13.462%]
  • 🟥 throughput [-281.775op/s; -161.223op/s] or [-12.250%; -7.009%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1

  • 🟥 throughput [-202.847op/s; -119.503op/s] or [-9.364%; -5.517%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟥 execution_time [+30.520µs; +54.312µs] or [+9.743%; +17.339%]
  • 🟥 throughput [-494.267op/s; -294.331op/s] or [-15.408%; -9.175%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.764ms; +300.437ms] or [+149.613%; +149.949%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • unstable execution_time [+361.567ms; +397.761ms] or [+392.857%; +432.184%]
  • 🟩 throughput [+1089.709op/s; +1253.340op/s] or [+8.954%; +10.299%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • unstable execution_time [+272.049ms; +311.406ms] or [+206.564%; +236.448%]
  • 🟩 throughput [+631.461op/s; +830.393op/s] or [+6.113%; +8.039%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+315.301ms; +347.683ms] or [+144.972%; +159.861%]
  • 🟥 throughput [-511.967op/s; -482.873op/s] or [-46.389%; -43.753%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • unstable execution_time [+202.197ms; +335.426ms] or [+86.168%; +142.944%]
  • 🟥 throughput [-673.368op/s; -589.919op/s] or [-44.914%; -39.348%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+337.036ms; +345.721ms] or [+201.587%; +206.781%]
  • 🟥 throughput [-399.136op/s; -364.413op/s] or [-27.791%; -25.374%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • 🟩 throughput [+19.169op/s; +43.839op/s] or [+5.510%; +12.602%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1

  • unstable throughput [+1.534op/s; +65.990op/s] or [+0.286%; +12.318%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0

  • 🟩 execution_time [-170.375µs; -140.332µs] or [-8.631%; -7.109%]
  • 🟩 throughput [+40.050op/s; +48.206op/s] or [+7.906%; +9.516%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+300.833ms; +302.954ms] or [+151.494%; +152.562%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 execution_time [+303.361ms; +304.872ms] or [+152.015%; +152.772%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 execution_time [+301.057ms; +304.130ms] or [+151.238%; +152.782%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+301.566ms; +303.010ms] or [+151.436%; +152.161%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 execution_time [+299.955ms; +302.503ms] or [+148.314%; +149.574%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 execution_time [+303.119ms; +306.708ms] or [+153.634%; +155.453%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+305.894ms; +308.602ms] or [+153.531%; +154.891%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 execution_time [+299.860ms; +301.663ms] or [+149.453%; +150.352%]
  • 🟩 throughput [+58412.116op/s; +63887.659op/s] or [+11.599%; +12.686%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 execution_time [+299.670ms; +302.152ms] or [+149.083%; +150.318%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [+7.322µs; +48.974µs] or [+1.809%; +12.097%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-20.647KB; -20.626KB] or [-7.531%; -7.524%]
  • unstable execution_time [-31.875µs; +21.152µs] or [-6.300%; +4.181%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟩 allocated_mem [-18.754KB; -18.738KB] or [-6.837%; -6.831%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • 🟥 execution_time [+5.893µs; +9.443µs] or [+13.930%; +22.321%]
  • 🟥 throughput [-4524.728op/s; -2839.525op/s] or [-19.048%; -11.954%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • unstable execution_time [-14.066µs; -6.880µs] or [-21.822%; -10.675%]
  • 🟩 throughput [+1771.150op/s; +3275.082op/s] or [+10.867%; +20.094%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+302.482ms; +303.725ms] or [+152.891%; +153.520%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+306.277ms; +308.748ms] or [+155.894%; +157.152%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+299.701ms; +301.748ms] or [+150.037%; +151.062%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟩 throughput [+32767.355op/s; +37652.360op/s] or [+6.202%; +7.127%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+299.992ms; +301.704ms] or [+149.519%; +150.372%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+300.576ms; +302.174ms] or [+150.935%; +151.737%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+304.401ms; +306.619ms] or [+154.373%; +155.497%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.624ms; +300.468ms] or [+149.454%; +149.875%]
  • 🟩 throughput [+66045807.905op/s; +66336347.527op/s] or [+48.099%; +48.310%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • unstable execution_time [+377.174ms; +411.020ms] or [+469.083%; +511.177%]
  • 🟩 throughput [+944.163op/s; +1116.081op/s] or [+7.299%; +8.628%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+299.754ms; +300.670ms] or [+149.510%; +149.968%]
  • 🟩 throughput [+18322103.232op/s; +19265796.552op/s] or [+8.115%; +8.533%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0

  • 🟩 throughput [+64379.571op/s; +79350.663op/s] or [+6.011%; +7.409%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1

  • 🟩 throughput [+57214.271op/s; +76344.991op/s] or [+6.622%; +8.837%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟩 throughput [+75890.973op/s; +108500.962op/s] or [+5.874%; +8.398%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟩 throughput [+77414.286op/s; +86043.135op/s] or [+7.688%; +8.545%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0

  • 🟩 throughput [+47538.719op/s; +53850.445op/s] or [+8.632%; +9.778%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

  • 🟩 throughput [+28961.125op/s; +38529.361op/s] or [+6.482%; +8.624%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0

  • 🟩 throughput [+79710.140op/s; +99392.806op/s] or [+8.906%; +11.105%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

dudikeleti and others added 2 commits May 6, 2026 16:15
When a debugger integration test's sample process crashes or exits early, the
test currently fails on the /stop HTTP call with a connection-refused error,
masking the real cause (the sample's exit code, stdout, stderr).

In StopSample:
* If Process.HasExited before sending /stop, log stdout/stderr/exit code and
  surface the exit code via ExitCodeException.ThrowIfNonZero.
* Wrap the WebRequest call in try/catch for WebException whose inner is
  HttpRequestException or SocketException, and apply the same handling when
  the process has exited mid-request.

This makes failing snapshot/probe tests show the real crash output instead of
a connection error.

Co-authored-by: Cursor <[email protected]>
Add focused coverage for the debugger sample helper path where the sample process has already exited with a non-zero code, ensuring StopSample surfaces the real exit code, stdout, and stderr instead of hiding the failure behind /stop cleanup.
@dudikeleti
dudikeleti force-pushed the dudik/debugger-sample-helper-surface-exit branch from 9826b2b to 5661419 Compare May 6, 2026 14:16
@dudikeleti dudikeleti changed the title [Debugger Tests] Surface real exit info when sample crashes during /stop [Debugger Tests] Surface sample exit diagnostics during /stop cleanup May 6, 2026
@dudikeleti
dudikeleti marked this pull request as ready for review May 6, 2026 14:18
@dudikeleti
dudikeleti merged commit 0d0a05e into master May 11, 2026
143 checks passed
@dudikeleti
dudikeleti deleted the dudik/debugger-sample-helper-surface-exit branch May 11, 2026 10:21
@github-actions github-actions Bot added this to the vNext-v3 milestone May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:debugger area:tests unit tests, integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants