Skip to content

Commit e0837ef

Browse files
author
Andrew Kent
committed
Fix remove PendingTrace from span cleaner bug
1 parent 9d49330 commit e0837ef

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

dd-trace-ot/src/main/java/datadog/opentracing/PendingTrace.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ public synchronized boolean clean() {
205205
while ((ref = referenceQueue.poll()) != null) {
206206
weakReferences.remove(ref);
207207
if (isWritten.compareAndSet(false, true)) {
208+
SPAN_CLEANER.pendingTraces.remove(this);
208209
// preserve throughput count.
209210
// Don't report the trace because the data comes from buggy uses of the api and is suspect.
210211
tracer.incrementTraceCount();

dd-trace-ot/src/test/groovy/datadog/opentracing/PendingTraceTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class PendingTraceTest extends Specification {
121121
trace.asList() == [rootSpan]
122122
writer == []
123123
traceCount.get() == 1
124+
!PendingTrace.SPAN_CLEANER.pendingTraces.contains(trace)
124125
}
125126

126127
def "add unfinished span to trace fails"() {

0 commit comments

Comments
 (0)