Skip to content

[Profiler] Fix crashes at shutdown - #9050

Open
gleocadie wants to merge 5 commits into
masterfrom
gleocadie/fix-race-at-shutdown
Open

[Profiler] Fix crashes at shutdown#9050
gleocadie wants to merge 5 commits into
masterfrom
gleocadie/fix-race-at-shutdown

Conversation

@gleocadie

Copy link
Copy Markdown
Collaborator

Summary of changes

This PR fixes a bunch of crashes that happen at shutdown. TOCTOU : Time Of Check to Time Of Use.

ICorprofiler callbacks where using .NET profiler services at shutdown 💥

Reason for change

A crash report brought a crash of the .NET profiler:

Error UnhandledException: Process was terminated due to an unhandled exception of type 'System.ExecutionEngineException'
0x7FF8D0CE4515 EEPolicy::HandleFatalError(unsigned int, unsigned long long, wchar_t const*, _EXCEPTION_POINTERS*, wchar_t const*, wchar_t const*) (D:\a\_work\1\s\src\coreclr\vm\eepolicy.cpp:777)
0x7FF8D0C6457F ProcessCLRException(_EXCEPTION_RECORD*, void*, _CONTEXT*, _DISPATCHER_CONTEXT*) (D:\a\_work\1\s\src\coreclr\vm\exceptionhandling.cpp:1066)
0x7FF9024052EF C:\Windows\SYSTEM32\ntdll.dll!<unknown>+a52ef
0x7FF90239192E C:\Windows\SYSTEM32\ntdll.dll!<unknown>+3192e
0x7FF9024042EE C:\Windows\SYSTEM32\ntdll.dll!<unknown>+a42ee
std::_Hash<std::_Umap_traits<unsigned long,std::unique_ptr<ThreadCpuInfo,std::default_delete<ThreadCpuInfo> >,std::_Uhash_compare<unsigned long,std::hash<unsigned long>,std::equal_to<unsigned long> >,std::allocator<std::pair<unsigned long const ,std::unique_ptr<ThreadCpuInfo,std::default_delete<ThreadCpuInfo> > > >,0> >::_Find_last(unsigned long const&, const unsigned long long) const (c:\devtools\vstudio\VC\Tools\MSVC\14.44.35207\include\xhash:1587)
0x7FF8EA873899 std::_Hash<std::_Umap_traits<unsigned long,std::unique_ptr<ThreadCpuInfo,std::default_delete<ThreadCpuInfo> >,std::_Uhash_compare<unsigned long,std::hash<unsigned long>,std::equal_to<unsigned long> >,std::allocator<std::pair<unsigned long const ,std::unique_ptr<ThreadCpuInfo,std::default_delete<ThreadCpuInfo> > > >,0> >::_Try_emplace<unsigned long const &>(unsigned long const&) (c:\devtools\vstudio\VC\Tools\MSVC\14.44.35207\include\xhash:701)
std::unordered_map<unsigned long,std::unique_ptr<ThreadCpuInfo,std::default_delete<ThreadCpuInfo> >,std::hash<unsigned long>,std::equal_to<unsigned long>,std::allocator<std::pair<unsigned long const ,std::unique_ptr<ThreadCpuInfo,std::default_delete<ThreadCpuInfo> > > > >::operator[](unsigned long const&) (c:\devtools\vstudio\VC\Tools\MSVC\14.44.35207\include\unordered_map:433)
0x7FF8EA873646 ThreadsCpuManager::Map(unsigned long, wchar_t const*) (c:\mnt\profiler\src\ProfilerEngine\Datadog.Profiler.Native\ThreadsCpuManager.cpp:51)
0x7FF8EA8453C5 CorProfilerCallback::ThreadNameChanged(unsigned long long, unsigned long, wchar_t*) (c:\mnt\profiler\src\ProfilerEngine\Datadog.Profiler.Native\CorProfilerCallback.cpp:2174)
0x7FF8EA9A5C92 datadog::shared::nativeloader::CorProfiler::ThreadNameChanged(unsigned long long, unsigned long, wchar_t*) (c:\mnt\shared\src\Datadog.Trace.ClrProfiler.Native\cor_profiler.cpp:988)
0x7FF8D0CEC7B6 EEToProfInterfaceImpl::ThreadNameChanged(unsigned long long, unsigned long, wchar_t*) (D:\a\_work\1\s\src\coreclr\vm\eetoprofinterfaceimpl.cpp:3071)
0x7FF8D0CDD04C ProfControlBlock::DoProfilerCallbackHelper<int (__cdecl*)(ProfilerInfo *),long (__cdecl*)(EEToProfInterfaceImpl *,unsigned __int64,unsigned long,wchar_t * const),unsigned __int64,unsigned long,wchar_t *>(ProfilerInfo*, int (*)(ProfilerInfo*), HRESULT (*)(EEToProfInterfaceImpl*, unsigned long long, unsigned long, wchar_t*), HRESULT*, unsigned long long, unsigned long, wchar_t*) (D:\a\_work\1\s\src\coreclr\inc\profilepriv.h:284)
0x7FF8D0C7FAF8 ThreadNative::InformThreadNameChange(Thread*, wchar_t const*, int) (D:\a\_work\1\s\src\coreclr\vm\comsynchronizable.cpp:970)
0x7FF8D0BD5E00 ThreadNative_InformThreadNameChange(QCall::ThreadHandle, wchar_t const*, int) (D:\a\_work\1\s\src\coreclr\vm\comsynchronizable.cpp:946)
0x7FF87427D256 System.Private.CoreLib.dll!System.Threading.Thread.SetThreadPoolWorkerThreadName
0x2441C77E620 <unknown>
0x7FF871089128 <unknown>
0xFEB42AFA80 <unknown>
0xFEB42AF818 <unknown>
0xFEB42AF7E0 <unknown>
0x180 <unknown>
0x878110FAF624 <unknown>
0x7FF8D0E839E0 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.21\coreclr.dll!<unknown>+3f39e0
0xFEB42AFBB8 <unknown>
0x7FF871111C48 <unknown>
0x7FF8D0A90000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.21\coreclr.dll!<unknown>+0
0xFEB42AF7E0 <unknown>
0x7FF87427D256 <unknown>
0xFEB42AF8A0 <unknown>
0x7FF87427CECA System.Private.CoreLib.dll!System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart

And in some other threads were could see that IIS was shutting down the application.

Implementation details

Use EngineActiveGuard to know if it's safe to use a service from within a callback.

This uses a reader/writer lock to prevent services from being destroyed while executing a callback but also prevent the callback from using the service(s) if they are cleaned up.

Test coverage

Add unit tests.

Other details

CorProfilerCallback's guarded ICorProfilerCallback methods checked
_isInitialized.load() with no lock spanning check-to-use, so a callback
could pass the check and still touch a service pointer DisposeServices()
concurrently destroys - a real crash (ExecutionEngineException via a
ThreadsCpuManager use-after-free) was traced to exactly this race.

Adds a std::shared_mutex + EngineActiveGuard RAII helper: callbacks take
a non-blocking shared lock and check _isShutdown while holding it (never
as a bare flag read); DisposeInternal() takes an exclusive lock, sets
_isShutdown, then tears down services - so no callback can observe the
engine as alive past that point, whether it's already in flight or
arrives after teardown completes.

Applies it to AppDomainCreationFinished, previously fully unguarded
despite using the _services-managed _pRuntimeIdStore. Remaining guarded
callbacks (ThreadCreated, ThreadDestroyed, ThreadAssignedToOSThread,
ThreadNameChanged, ModuleLoadFinished, ExceptionThrown) follow in
subsequent commits.
Replaces the racy _isInitialized.load() guard with EngineActiveGuard in
ThreadCreated, ThreadDestroyed, ThreadAssignedToOSThread, and
ThreadNameChanged - the confirmed crash site (a ThreadPool worker
renaming itself raced CorProfilerCallback::Shutdown() tearing down
ThreadsCpuManager, producing a use-after-free deep inside
std::unordered_map's internals, surfaced as ExecutionEngineException).

Same mechanism as the previous commit, applied to the four callbacks
that most directly motivated this fix.
Replaces the racy _isInitialized.load() guard with EngineActiveGuard in
ModuleLoadFinished and ExceptionThrown, same mechanism as the previous
two commits.

This covers every ICorProfilerCallback method identified in the
blast-radius audit as reading a _services-managed pointer behind the
old check-then-use pattern. Two related, lower-priority items found
during the audit are deliberately left out of this change:
OnThreadRoutineFinished (Linux-only, guards via a different _this-null
idiom, not implicated in the Windows crash this fix addresses) and
OnStartDelayedProfiling (a different risk shape - concurrent iteration
of _services during StartServices(), rather than a read of an
already-nulled pointer).
…tdown flag

The original _isInitialized.load() check the callbacks used to have was
doing double duty: "has Initialize() finished yet" AND "has shutdown
started". EngineActiveGuard only replaced the second half - a callback
firing before Initialize() finishes constructing services would now
incorrectly report IsActive() == true. Fixed by having the guard check
isInitialized directly (a plain atomic read is fine here, since that
direction of the lifecycle never destroys anything concurrently - only
the shutdown direction needed the mutex).

Also renames _isShutdown to _isServicesShutdown for clarity: it tracks
specifically whether DisposeServices() has run, not overall process
lifetime.
Covers both halves of the guard directly: not-yet-initialized,
already-shut-down (the confirmed crash scenario), a writer blocking a
would-be reader (non-blocking try_to_lock, callbacks never wait), a
reader blocking a writer until released (in-flight callbacks finish
before DisposeServices() can run), and concurrent readers not
serializing against each other.

All 583 tests in the native suite pass (1 pre-existing, unrelated skip).
@gleocadie
gleocadie requested a review from a team as a code owner August 13, 2026 16:14
@github-actions github-actions Bot added the area:profiler Issues related to the continous-profiler label Aug 13, 2026

@chrisnas chrisnas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

#include <atomic>
#include <shared_mutex>

// Non-blocking guard for ICorProfilerCallback methods that read service pointers whose lifetime

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably too verbose comment

std::shared_ptr<IMetricsSender> _metricsSender;
std::atomic<bool> _isInitialized{false}; // pay attention to keeping ProfilerEngineStatus::IsProfilerEngiveActive in sync with this!

// Guards ICorProfilerCallback methods (see EngineActiveGuard.h) against DisposeInternal()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it simpler

@pr-commenter

pr-commenter Bot commented Aug 13, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-13 16:59:48

Comparing candidate commit f5c7cae in PR branch gleocadie/fix-race-at-shutdown with baseline commit 13aa3a5 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 1 performance regressions! Performance is the same for 71 metrics, 0 unstable metrics, 65 known flaky benchmarks, 61 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 ----------------------------------'

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery net472

  • 🟥 throughput [-25004.634op/s; -22159.593op/s] or [-7.043%; -6.241%]

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 [-8710.419op/s; -8150.431op/s] or [-10.328%; -9.664%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0

  • 🟥 throughput [-9210.693op/s; -6535.960op/s] or [-7.742%; -5.494%]

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

  • 🟥 throughput [-10772.441op/s; -9217.434op/s] or [-10.953%; -9.372%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+310.768ms; +318.042ms] or [+154.214%; +157.824%]
  • 🟥 throughput [-43.064op/s; -39.040op/s] or [-7.748%; -7.024%]

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

  • 🟥 execution_time [+379.677ms; +381.740ms] or [+299.968%; +301.598%]
  • 🟩 throughput [+91.442op/s; +94.927op/s] or [+12.056%; +12.516%]

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

  • 🟥 execution_time [+391.867ms; +395.101ms] or [+346.788%; +349.649%]

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

  • 🟥 allocated_mem [+4.692KB; +4.693KB] or [+98.785%; +98.801%]
  • 🟥 throughput [-60419.562op/s; -60045.516op/s] or [-47.010%; -46.718%]

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

  • 🟥 allocated_mem [+3.816KB; +3.816KB] or [+80.699%; +80.711%]
  • 🟩 execution_time [-15.831ms; -11.651ms] or [-7.394%; -5.441%]
  • 🟥 throughput [-59950.703op/s; -57185.368op/s] or [-43.761%; -41.742%]

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

  • 🟥 allocated_mem [+4.544KB; +4.544KB] or [+98.261%; +98.274%]
  • 🟥 throughput [-48523.757op/s; -46256.852op/s] or [-43.871%; -41.822%]

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

  • 🟥 allocated_mem [+1.315KB; +1.315KB] or [+106.388%; +106.404%]
  • 🟥 throughput [-254055.116op/s; -249492.940op/s] or [-25.940%; -25.474%]

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

  • 🟥 allocated_mem [+479 bytes; +480 bytes] or [+39.212%; +39.221%]
  • 🟩 execution_time [-25.867ms; -21.002ms] or [-11.536%; -9.366%]

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

  • 🟥 allocated_mem [+1.280KB; +1.280KB] or [+105.947%; +105.963%]
  • 🟥 throughput [-164898.645op/s; -148566.494op/s] or [-23.693%; -21.346%]

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

  • 🟥 allocated_mem [+3.378KB; +3.378KB] or [+89.003%; +89.017%]
  • 🟥 throughput [-72719.853op/s; -71964.467op/s] or [-48.940%; -48.431%]

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

  • 🟥 allocated_mem [+3.336KB; +3.336KB] or [+88.150%; +88.161%]
  • 🟥 throughput [-73493.735op/s; -70600.844op/s] or [-46.763%; -44.922%]

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

  • 🟥 allocated_mem [+3.264KB; +3.264KB] or [+88.493%; +88.506%]
  • 🟥 throughput [-55925.889op/s; -53312.313op/s] or [-44.552%; -42.470%]

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

  • 🟩 throughput [+295014.513op/s; +326338.506op/s] or [+9.837%; +10.882%]

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

  • 🟩 execution_time [-19.009ms; -14.680ms] or [-8.762%; -6.767%]

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

  • 🟩 allocated_mem [-13.759KB; -13.756KB] or [-42.324%; -42.316%]
  • 🟥 execution_time [+300.203ms; +300.765ms] or [+150.001%; +150.282%]
  • 🟩 throughput [+959.965op/s; +990.607op/s] or [+10.603%; +10.941%]

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

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+299.643ms; +302.808ms] or [+151.111%; +152.707%]
  • 🟩 throughput [+2282.688op/s; +2509.958op/s] or [+17.459%; +19.197%]

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

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+299.871ms; +302.252ms] or [+151.052%; +152.251%]
  • 🟩 throughput [+1805.893op/s; +1933.968op/s] or [+17.435%; +18.671%]

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

  • 🟥 execution_time [+295.983ms; +297.886ms] or [+145.375%; +146.310%]
  • 🟩 throughput [+588.201op/s; +600.809op/s] or [+15.593%; +15.928%]

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

  • 🟥 execution_time [+296.771ms; +299.215ms] or [+145.080%; +146.275%]
  • 🟩 throughput [+2656.446op/s; +2692.392op/s] or [+38.593%; +39.115%]

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

  • 🟥 execution_time [+301.066ms; +302.171ms] or [+150.472%; +151.024%]
  • 🟩 throughput [+1349.336op/s; +1369.644op/s] or [+26.783%; +27.186%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472

  • 🟩 execution_time [-143.543µs; -138.657µs] or [-29.471%; -28.468%]
  • 🟩 throughput [+821.199op/s; +855.810op/s] or [+39.996%; +41.682%]

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

  • 🟩 execution_time [-138.400µs; -111.502µs] or [-31.742%; -25.573%]
  • 🟩 throughput [+853.091op/s; +980.205op/s] or [+37.089%; +42.615%]

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

  • 🟩 execution_time [-142.354µs; -120.358µs] or [-30.500%; -25.787%]
  • 🟩 throughput [+774.417op/s; +857.245op/s] or [+35.749%; +39.572%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472

  • 🟩 execution_time [-124.899µs; -120.233µs] or [-33.722%; -32.462%]
  • 🟩 throughput [+1308.504op/s; +1366.259op/s] or [+48.461%; +50.600%]

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

  • 🟩 execution_time [-105.062µs; -81.488µs] or [-33.541%; -26.015%]
  • 🟩 throughput [+1238.780op/s; +1439.636op/s] or [+38.616%; +44.878%]

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

  • 🟩 execution_time [-136.520µs; -114.120µs] or [-37.346%; -31.219%]
  • 🟩 throughput [+1308.406op/s; +1445.599op/s] or [+46.953%; +51.877%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.522ms; +300.336ms] or [+149.492%; +149.899%]

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

  • 🟥 execution_time [+410.339ms; +419.357ms] or [+445.850%; +455.648%]
  • 🟩 throughput [+838.688op/s; +1080.807op/s] or [+6.892%; +8.881%]

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

  • unstable execution_time [+248.446ms; +310.956ms] or [+188.643%; +236.106%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+276.859ms; +335.675ms] or [+127.297%; +154.340%]
  • 🟥 throughput [-550.330op/s; -498.981op/s] or [-49.865%; -45.213%]

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

  • unstable execution_time [+142.831ms; +288.963ms] or [+60.868%; +123.144%]
  • 🟥 throughput [-666.705op/s; -583.238op/s] or [-44.469%; -38.902%]

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

  • 🟥 execution_time [+335.908ms; +345.298ms] or [+200.912%; +206.528%]
  • 🟥 throughput [-389.385op/s; -352.463op/s] or [-27.112%; -24.542%]

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

  • unstable throughput [+11.506op/s; +125.084op/s] or [+2.148%; +23.348%]

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

  • 🟩 execution_time [-202.277µs; -172.228µs] or [-10.247%; -8.724%]
  • 🟩 throughput [+49.442op/s; +57.594op/s] or [+9.760%; +11.370%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+302.664ms; +303.881ms] or [+152.416%; +153.029%]

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

  • 🟥 execution_time [+301.056ms; +302.328ms] or [+150.860%; +151.497%]

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

  • 🟥 execution_time [+302.905ms; +306.444ms] or [+152.167%; +153.944%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+302.065ms; +304.068ms] or [+151.687%; +152.693%]

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

  • 🟥 execution_time [+297.336ms; +300.303ms] or [+147.019%; +148.487%]

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

  • 🟥 execution_time [+302.425ms; +306.163ms] or [+153.282%; +155.177%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+302.162ms; +304.375ms] or [+151.658%; +152.769%]

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

  • 🟥 execution_time [+302.688ms; +306.416ms] or [+150.862%; +152.720%]
  • 🟩 throughput [+44797.438op/s; +51431.653op/s] or [+8.895%; +10.213%]

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

  • 🟥 execution_time [+300.508ms; +302.876ms] or [+149.500%; +150.678%]

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

  • unstable execution_time [+19.887µs; +66.376µs] or [+4.912%; +16.395%]

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

  • 🟩 allocated_mem [-19.837KB; -19.814KB] or [-7.236%; -7.228%]
  • unstable execution_time [-48.799µs; +6.102µs] or [-9.645%; +1.206%]

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

  • unstable execution_time [-51.583µs; +9.346µs] or [-8.939%; +1.620%]

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

  • unstable execution_time [+11.129µs; +16.118µs] or [+26.305%; +38.098%]
  • 🟥 throughput [-6625.234op/s; -4696.506op/s] or [-27.890%; -19.771%]

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

  • unstable execution_time [-12.305µs; -4.137µs] or [-19.091%; -6.418%]
  • unstable throughput [+943.213op/s; +2720.517op/s] or [+5.787%; +16.691%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+302.156ms; +303.508ms] or [+152.726%; +153.410%]

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

  • 🟥 execution_time [+306.400ms; +310.948ms] or [+155.956%; +158.272%]

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

  • 🟥 execution_time [+299.295ms; +301.777ms] or [+149.834%; +151.076%]

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

  • 🟩 throughput [+34062.774op/s; +36847.372op/s] or [+6.447%; +6.974%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+301.512ms; +303.917ms] or [+150.276%; +151.475%]

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

  • 🟥 execution_time [+301.816ms; +303.261ms] or [+151.557%; +152.283%]

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

  • 🟥 execution_time [+301.781ms; +304.106ms] or [+153.044%; +154.223%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+298.950ms; +300.005ms] or [+149.118%; +149.644%]
  • 🟩 throughput [+60280545.684op/s; +61027650.273op/s] or [+43.900%; +44.444%]

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

  • unstable execution_time [+343.063ms; +401.703ms] or [+426.660%; +499.589%]

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

  • 🟥 execution_time [+299.314ms; +300.584ms] or [+149.291%; +149.925%]
  • 🟩 throughput [+17727651.277op/s; +18698380.974op/s] or [+7.852%; +8.282%]

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

  • 🟩 throughput [+108381.094op/s; +115862.458op/s] or [+10.119%; +10.818%]

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

  • 🟩 throughput [+76195.281op/s; +85334.044op/s] or [+7.567%; +8.475%]

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

  • 🟩 throughput [+54328.013op/s; +62266.105op/s] or [+9.865%; +11.306%]

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

  • 🟩 throughput [+46634.199op/s; +64768.231op/s] or [+5.210%; +7.236%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
  • 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.StartFinishScope netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@dd-trace-dotnet-ci-bot

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (9050) and master.

✅ No regressions detected

📄 View the full report (charts + all metrics) →

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 identified-by:crashtracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants