Commit 7be2605
Fix flaky PendingTraceBufferTest by removing buffer thread race (#10800)
Fix flaky PendingTraceBufferTest by removing buffer thread race
The "continuation allows adding after root finished" test was flaky
because it started the buffer worker thread before calling
continuation.cancel(). The worker thread could process the enqueued
trace before the continuation was cancelled, causing extra mock
invocations (TooManyInvocationsError).
The fix removes buffer.start() since it's unnecessary: when the
continuation is cancelled and pendingReferenceCount drops to 0 with
rootSpanWritten still false, PendingTrace.write() is called
synchronously on the calling thread. This eliminates the race
condition entirely.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>1 parent 3ee21aa commit 7be2605
File tree
1 file changed
+7
-8
lines changed- dd-trace-core/src/test/groovy/datadog/trace/core
1 file changed
+7
-8
lines changedLines changed: 7 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
272 | | - | |
273 | 271 | | |
274 | 272 | | |
275 | 273 | | |
| |||
302 | 300 | | |
303 | 301 | | |
304 | 302 | | |
305 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
306 | 309 | | |
307 | | - | |
308 | 310 | | |
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
313 | | - | |
314 | 315 | | |
315 | | - | |
316 | | - | |
317 | | - | |
| 316 | + | |
318 | 317 | | |
319 | 318 | | |
320 | 319 | | |
| |||
0 commit comments