ThreadedAnalyticsDestination data race

Hi there,
we spotted (and fixed) a data race in the ThreadedAnalyticsDestination.

The original has a const ScopedLock lock (queueAccess); on line 101. That needs to move to line 92 to remove the data race. The final version looks like this:

while (! threadShouldExit())
const ScopedLock lock (queueAccess);

        const auto numEventsInBatch = eventsToSend.size();
        const auto freeBatchCapacity = maxBatchSize - numEventsInBatch;

        if (freeBatchCapacity > 0)

Ed, Tom, let me know if you need more info (or just a patch if thats easiest)


Thank you for reporting.

1 Like

Nice one, thanks Tom!