Fix remove PendingTrace from span cleaner bug

This commit is contained in:
Andrew Kent 2018-08-24 15:37:44 -07:00
parent 9d4933011e
commit e0837efb5b
2 changed files with 2 additions and 0 deletions

View File

@ -205,6 +205,7 @@ public class PendingTrace extends ConcurrentLinkedDeque<DDSpan> {
while ((ref = referenceQueue.poll()) != null) {
weakReferences.remove(ref);
if (isWritten.compareAndSet(false, true)) {
SPAN_CLEANER.pendingTraces.remove(this);
// preserve throughput count.
// Don't report the trace because the data comes from buggy uses of the api and is suspect.
tracer.incrementTraceCount();

View File

@ -121,6 +121,7 @@ class PendingTraceTest extends Specification {
trace.asList() == [rootSpan]
writer == []
traceCount.get() == 1
!PendingTrace.SPAN_CLEANER.pendingTraces.contains(trace)
}
def "add unfinished span to trace fails"() {