CommandersAct / AndroidV5

Other
5 stars 2 forks source link

ConcurrentModificationException #2

Closed claudiochiumarulo closed 1 year ago

claudiochiumarulo commented 1 year ago

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

CommandersAct commented 1 year ago

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

CommandersAct commented 1 year ago

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

CommandersAct commented 1 year ago

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

claudiochiumarulo commented 1 year ago

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

CommandersAct commented 1 year ago

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