Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ConcurrentModificationException at initializeFromModel in production #1850

Closed
1 task done
fanwgwg opened this issue Sep 24, 2023 · 19 comments · Fixed by #1849
Closed
1 task done

[Bug]: ConcurrentModificationException at initializeFromModel in production #1850

fanwgwg opened this issue Sep 24, 2023 · 19 comments · Fixed by #1849

Comments

@fanwgwg
Copy link

fanwgwg commented Sep 24, 2023

What happened?

From user crash logs, we're seeing quite a few ConcurrentModificationException from OneSignal's initializeFromModel method

Stacktrace:

Fatal Exception: java.util.ConcurrentModificationException:
       at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:757)
       at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:790)
       at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:788)
       at com.onesignal.common.modeling.Model.initializeFromModel(Model.kt:123)
       at com.onesignal.core.internal.config.impl.ConfigModelStoreListener$fetchParams$1.invokeSuspend(ConfigModelStoreListener.kt:69)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
       at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
       at kotlinx.coroutines.BlockingCoroutine.joinBlocking(BlockingCoroutine.java:85)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(BuildersKt__Builders.kt:59)
       at kotlinx.coroutines.BuildersKt.runBlocking(Builders.kt:1)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(BuildersKt__Builders.kt:38)
       at kotlinx.coroutines.BuildersKt.runBlocking$default(Builders.kt:1)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:60)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:59)
       at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Threads.kt:30)

Steps to reproduce?

Not sure how to reproduce, here's

What did you expect to happen?

Should not crash

OneSignal Android SDK version

5.0.1

Android version

13

Specific Android models

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@michael-winkler
Copy link

Is this issue not the same as #1820 ?

@emawby
Copy link
Contributor

emawby commented Sep 25, 2023

@fanwgwg Thank you for reporting this issue is likely fixed by #1849 and will be released ASAP!

@emawby emawby linked a pull request Sep 25, 2023 that will close this issue
18 tasks
@jkasten2
Copy link
Member

OneSignal-Android-SDK 5.0.2 was released with the PR noted above. Let us know if that fixes this issue for you or if it continue to happen.

@Neferetheka
Copy link

@jkasten2 Can confirm this still happens in V5.0.2 (using the Unity SDK)

@fanwgwg
Copy link
Author

fanwgwg commented Oct 5, 2023

+1 Still happening in V5.0.2 Android SDK

@Neferetheka
Copy link

One note, for those using the Unity SDK. It appears Unity V5.0.2 actually uses the Android SDK V5.0.1. So I'm actually not quite sure the bug still happens if you have the latest Android release.

@fanwgwg
Copy link
Author

fanwgwg commented Oct 5, 2023

We have the same exception being reported by Crashlytics on our latest release that was shipped with OneSignal's 5.0.2

@SuperBuper
Copy link

The same issue is on Android 12, 13 with OneSigna 5.0.2
Fatal Exception: java.util.ConcurrentModificationException
com.onesignal.common.modeling.Model.initializeFromModel (Model.kt:124)

@nan-li
Copy link
Contributor

nan-li commented Oct 6, 2023

Hi all, @SuperBuper @fanwgwg thanks for letting us know the latest Android SDK version 5.0.2 did not resolve this crash.

Can you provide updated logs? We want to confirm they are exactly the same.

@fanwgwg
Copy link
Author

fanwgwg commented Oct 7, 2023

@nan-li Here's the crash log from 5.0.2

Fatal Exception: java.util.ConcurrentModificationException:
       at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:757)
       at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:790)
       at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:788)
       at com.onesignal.common.modeling.Model.initializeFromModel(Model.kt:124)
       at com.onesignal.core.internal.config.impl.ConfigModelStoreListener$fetchParams$1.invokeSuspend(ConfigModelStoreListener.kt:69)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
       at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
       at kotlinx.coroutines.BlockingCoroutine.joinBlocking(BlockingCoroutine.java:85)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(BuildersKt__Builders.kt:59)
       at kotlinx.coroutines.BuildersKt.runBlocking(Builders.kt:1)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(BuildersKt__Builders.kt:38)
       at kotlinx.coroutines.BuildersKt.runBlocking$default(Builders.kt:1)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:60)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:59)
       at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Threads.kt:30)

@terreng
Copy link

terreng commented Oct 10, 2023

Still an issue. Seeing crashes in production. Android SDK 5.0.2.

Stack trace from Android 7.1.2 device
Fatal Exception: java.util.ConcurrentModificationException:
       at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:429)
       at java.util.LinkedHashMap$EntryIterator.next(LinkedHashMap.java:448)
       at java.util.LinkedHashMap$EntryIterator.next(LinkedHashMap.java:448)
       at com.onesignal.common.modeling.Model.initializeFromModel(Model.kt:124)
       at com.onesignal.core.internal.config.impl.ConfigModelStoreListener$fetchParams$1.invokeSuspend(ConfigModelStoreListener.kt:69)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
       at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
       at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
       at kotlinx.coroutines.BuildersKt.runBlocking(:1)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
       at kotlinx.coroutines.BuildersKt.runBlocking$default(:1)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:60)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:59)
       at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)
Stack trace from Android 12 device
Fatal Exception: java.util.ConcurrentModificationException:
       at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:760)
       at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:792)
       at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:790)
       at com.onesignal.common.modeling.Model.initializeFromModel(Model.kt:124)
       at com.onesignal.core.internal.config.impl.ConfigModelStoreListener$fetchParams$1.invokeSuspend(ConfigModelStoreListener.kt:69)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
       at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
       at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
       at kotlinx.coroutines.BuildersKt.runBlocking(:1)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
       at kotlinx.coroutines.BuildersKt.runBlocking$default(:1)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:60)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:59)
       at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

@nan-li
Copy link
Contributor

nan-li commented Oct 12, 2023

Hi all, I apologize for any delay,

We have identified the cause and are working on the fix for all the methods this crash is reported.

@jennantilla
Copy link
Contributor

Hello everyone! Thank you for your patience here. We have introduced a fix for this crash in our latest release, 5.0.4. Please update your SDK and let us know if you are still having any issues.

@jennantilla
Copy link
Contributor

Closing out this issue. Please let us know if you are seeing any further occurrences of this exception. Thanks!

@ajaybirla-fabzen
Copy link

ajaybirla-fabzen commented Nov 18, 2023

Hi @jennantilla,

We're still facing this issue in the OneSignal Unity SDK for Android v5.0.5.

Caused by java.util.ConcurrentModificationException: at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:760) at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:792) at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:790) at com.onesignal.common.modeling.Model.initializeFromModel(Model.kt:124) at com.onesignal.core.internal.config.impl.ConfigModelStoreListener$fetchParams$1.invokeSuspend(ConfigModelStoreListener.kt:69) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33) at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) at kotlinx.coroutines.BuildersKt.runBlocking(:1) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) at kotlinx.coroutines.BuildersKt.runBlocking$default(:1) at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:60) at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:59) at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

@jennantilla
Copy link
Contributor

Thank you for letting us know! We'll investigate this further.

@jennantilla
Copy link
Contributor

@ajaybirla-fabzen sorry for missing this--I see you mention Unity SDK specifically, which does not yet have this fix. A release that will incorporate this is in the works and should be ready by next week. You can check releases here. Thanks!

@ajaybirla-fabzen
Copy link

@jennantilla Thank you for the update.

@ajaybirla-fabzen
Copy link

Hi @jennantilla,

When can I expect the next Unity SDK update to include this fix?

We're planning an update to our app, and it would be good if this fix was included in the update.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants