Downgrade DSM flush shutdown log from Error to Warning#7984
Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (7984) 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 (7984) - mean (69ms) : 67, 70
master - mean (68ms) : 66, 70
section Bailout
This PR (7984) - mean (72ms) : 71, 73
master - mean (72ms) : 71, 73
section CallTarget+Inlining+NGEN
This PR (7984) - mean (1,009ms) : 970, 1047
master - mean (1,006ms) : 968, 1044
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 (7984) - mean (106ms) : 104, 108
master - mean (106ms) : 103, 108
section Bailout
This PR (7984) - mean (107ms) : 106, 108
master - mean (107ms) : 105, 108
section CallTarget+Inlining+NGEN
This PR (7984) - mean (710ms) : 683, 737
master - mean (712ms) : 678, 746
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7984) - mean (94ms) : 92, 96
master - mean (94ms) : 92, 96
section Bailout
This PR (7984) - mean (94ms) : 93, 96
master - mean (94ms) : 93, 95
section CallTarget+Inlining+NGEN
This PR (7984) - mean (669ms) : 650, 687
master - mean (667ms) : 643, 690
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7984) - mean (92ms) : 90, 94
master - mean (92ms) : 90, 94
section Bailout
This PR (7984) - mean (93ms) : 92, 94
master - mean (93ms) : 92, 94
section CallTarget+Inlining+NGEN
This PR (7984) - mean (633ms) : 617, 649
master - mean (630ms) : 614, 646
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 (7984) - mean (195ms) : 190, 200
master - mean (194ms) : 190, 199
section Bailout
This PR (7984) - mean (200ms) : 194, 207
master - mean (197ms) : 194, 200
section CallTarget+Inlining+NGEN
This PR (7984) - mean (1,141ms) : 1056, 1226
master - mean (1,117ms) : 1064, 1170
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 (7984) - mean (280ms) : 271, 288
master - mean (278ms) : 272, 284
section Bailout
This PR (7984) - mean (281ms) : 273, 289
master - mean (278ms) : 274, 282
section CallTarget+Inlining+NGEN
This PR (7984) - mean (914ms) : 863, 965
master - mean (909ms) : 867, 950
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7984) - mean (272ms) : 266, 278
master - mean (271ms) : 266, 277
section Bailout
This PR (7984) - mean (271ms) : 267, 275
master - mean (270ms) : 267, 274
section CallTarget+Inlining+NGEN
This PR (7984) - mean (889ms) : 842, 935
master - mean (888ms) : 847, 929
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7984) - mean (271ms) : 264, 278
master - mean (271ms) : 265, 277
section Bailout
This PR (7984) - mean (270ms) : 266, 273
master - mean (270ms) : 267, 274
section CallTarget+Inlining+NGEN
This PR (7984) - mean (830ms) : 805, 854
master - mean (825ms) : 808, 842
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BenchmarksBenchmark execution time: 2025-12-19 20:16:12 Comparing candidate commit e97545b in PR branch Found 7 performance improvements and 4 performance regressions! Performance is the same for 163 metrics, 12 unstable metrics. scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1
scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
|
## Summary of changes Stop disposing the `_flushSemaphore` and `_drainSignal` synchronization primitives in `DataStreamsWriter.DisposeAsync`. ## Reason for change Flaky CI failures (e.g. `DataStreamsMonitoringRabbitMQTests`) where `CheckBuildLogsForErrors` finds: ``` [Error] Error in data streams flush task System.AggregateException: ... (The semaphore has been disposed.) ---> System.ObjectDisposedException: The semaphore has been disposed. at System.Threading.SemaphoreSlim.Release(Int32 releaseCount) at Datadog.Trace.DataStreamsMonitoring.DataStreamsWriter.FlushAggregatorAsync() ``` This is a third variant of the disposal race partially addressed by #7968 and #7984. `FlushAndCloseAsync` waits for both the process and flush tasks, but with a 1-second fallback that must exist so process exit can never hang. On an overloaded CI host, the flush task can still be inside `FlushAggregatorAsync` (blocked in `_api.SendAsync`) when the fallback fires. `DisposeAsync` then disposes `_flushSemaphore`, and when the send returns, the `finally` block's `_flushSemaphore.Release()` throws `ObjectDisposedException`, faulting `_flushTask` and logging a spurious `[Error]` during shutdown. The same race exists latently for `_drainSignal` via `ProcessQueueLoop`. The 1-second fallback is load-bearing, so the race can't be closed by waiting longer. ## Implementation details `SemaphoreSlim` and `ManualResetEventSlim` only hold an unmanaged resource (a lazily-created wait handle) if their `AvailableWaitHandle`/`WaitHandle` property is accessed. This class never does — it only uses `WaitAsync`/`Wait`/`Release`/`Set`/`Reset`/`IsSet`. So `Dispose()` here is a no-op apart from arming the `ObjectDisposedException`. Removing both `Dispose()` calls eliminates the race at its source with no resource leak. Added a comment so the calls aren't reintroduced. ## Test coverage Covered by existing DSM tests; this removes the spurious shutdown error that `CheckBuildLogsForErrors` was flagging. ## Other details
Summary of changes
Addressing some test flake. This can happen in an overloaded CI environment.
Reason for change
Implementation details
Test coverage
Other details