Closed jp2014 closed 1 year ago
Hello! Any updates here? We are still seeing a lot of crashes in our production app. Thanks!
We've updated to the latest 1.8.2 version and continue to see a large amount of crashes. Any updates are appreciated!
Hi @jp2014 thanks for bringing this to our attention. Unfortunately we have not been able to reproduce this on our end.
The error logs are really helpful. Starting with 1.8.2
you should no longer see second error at com.amplitude.core.platform.intercept.IdentifyInterceptFileStorageHandler.fetchAndMergeToIdentifyEvent
.
We will investigate further and try to locate the root cause.
To help us debug can you please provide some more details.
Thanks!
Here's our wrapper class. It's created as a singleton early in app lifecycle. We use all of the wrapped function in this class. We don't add any plugins to amplitude or wrap it with any plugins. We do use Amplitude Experiment as well and do use the initializeWithAmplitudeAnalytics
and automaticFetchOnAmplitudeIdentityChange
features. I'm not able to reliably reproduce this on my end either, but I have seen it.
I think it should be reproducible with some test code that concurrently calls Timeline.applyPlugins
, Timeline.remove
, etc a bunch of times.
Thank you!
class AmplitudeAnalyticsWrapperImpl(token: String, context: Context) : AmplitudeAnalyticsWrapper {
private val amplitudeClient: Amplitude
init {
val config = Configuration(
apiKey = token,
context = context,
trackingSessionEvents = true
)
amplitudeClient = Amplitude(config)
}
override fun track(key: String, data: Map<String, Any>) {
safeClientCall {
amplitudeClient.track(key, data)
}
}
override fun setUserId(id: String) {
safeClientCall {
amplitudeClient.setUserId(id)
}
}
override fun identify(identify: Identify) {
safeClientCall {
amplitudeClient.identify(identify)
}
}
override fun reset() {
safeClientCall {
amplitudeClient.reset()
}
}
override fun revenue(revenue: Revenue) {
safeClientCall {
amplitudeClient.revenue(revenue)
}
}
private fun safeClientCall(call: () -> Unit) {
try {
call()
} catch (e: Exception) {
log(e)
}
}
}
Hi @jp2014 we released v1.9.1 with a potential fix. Can you please update and let us know if that works for you. Thanks!
Thanks @justin-fiedler. We are still early in our release, but no crashes so far! Thank you!
Expected Behavior
SDK should not cause ConcurrentModificationExceptions
Current Behavior
SDK Version: 1.7.1
We are seeing a pretty heavy volume of ConcurrentModificationExceptions caused by the Amplitude-Kotlin SDK. We've seen about 5k crashes over the last month related to this.
Possible Solution
My best guess is that com.amplitude.core.platform.Timeline.plugins is not thread safe. Plugins could be added/removed/modified from different threads which would cause this exception.
Steps to Reproduce
I'm unable to reproduce, but we see quite a few reports of this in our error logging.
Environment