CommandersAct/AndroidV5

ConcurrentModificationException

Closed this issue · 5 comments

Hi, I recently implemented this library. I sometimes experience this crash

FATAL EXCEPTION: DefaultDispatcher-worker-7
      Process: , PID: 31547
      java.util.ConcurrentModificationException
      at java.util.ArrayList$Itr.next(ArrayList.java:860)
      at com.tagcommander.lib.core.TCAdditionalProperties.addAdditionalProperty(TCAdditionalProperties.java:68)
      at com.tagcommander.lib.serverside.TCServerSide.execute(TCServerSide.java:114)
      at data.tracking.tracker.tagcommander.TagCommanderAnalyticsWrapper.trackEvent(TagCommanderAnalyticsWrapper.kt:80)
      at data.tracking.tracker.tagcommander.TagCommanderAnalyticsQueueWrapper.internalTrackEventWithBundleParams(TagCommanderAnalyticsQueueWrapper.kt:178)
at data.tracking.tracker.tagcommander.TagCommanderAnalyticsQueueWrapper.access$internalTrackEventWithBundleParams(TagCommanderAnalyticsQueueWrapper.kt:16)
at data.tracking.tracker.tagcommander.TagCommanderAnalyticsQueueWrapper$ready$1.invokeSuspend(TagCommanderAnalyticsQueueWrapper.kt:81)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@505995, Dispatchers.IO]

The crash points at the iterator.next() in the addAdditionalProperty method called on events in the execute()
My guess is that some call to removePermanentData changes the list when the execute flow is iterating on it

I'm currently using version 5.3.0 for the Core library, and version 5.3.1 of the ServerSide library

Hello,
Thank you for reaching out, our team is currently investigating for a fix.

Hello !
We released a new version of the ServerSide module which should solve this concurrency issue.

Hello ! Can you confirm that the issue was solved with the release from last month please?

Hi, I wasn’t able to reproduce the issue consistently, so I cannot confirm the fix, unfortunately. We solved it by executing all the calls on a single threaded dispatcher

I'll close it for now since no one else had any issues since then.
Thank you.