OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
625 stars 214 forks source link

[Bug]: Fatal Exception: java.util.ConcurrentModificationException On Android Only #820

Closed indrian16 closed 9 months ago

indrian16 commented 10 months ago

What happened?

I found force closes in crashlytics data that mostly occurred on Android 13 and Android 14 devices, after using the flutter onesignal versions: onesignal_flutter: ^5.0.4 and onesignal_flutter: ^5.0.3.

Steps to reproduce?

1. Check permission (user denny permission)
2. Call OneSignal Login
3. Backend assign tags data
4. Crash happened
OR
1. Check permission (user granted permission)
2. Call OneSignal Login
3. Backend assign tags data
4. It's still OK, but the next user disables notification permission.
5. Then a crash could occur

Force closes only occur on the Android platform and are found on versions 13 and 14. 
On iOS, it is safe and there are no crashes if notifications are disabled.

LinkVideo: https://www.veed.io/view/id-ID/c6c16c90-f859-47de-8abd-d7b6f6dc0a37?panel=share

What did you expect to happen?

Force Close will no longer occur.

OneSignal Flutter SDK version

Release 5.0.4

Which platform(s) are affected?

Relevant log output

Fatal Exception: java.util.ConcurrentModificationException:
       at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1029)
       at java.util.ArrayList$Itr.next(ArrayList.java:982)
       at com.onesignal.common.events.b.fire(EventProducer.kt:2)
       at com.onesignal.core.internal.application.impl.c.setCurrent(ApplicationService.kt:3)
       at com.onesignal.core.internal.application.impl.c.onActivityStarted(ApplicationService.kt:3)
       at android.app.Application.dispatchActivityStarted(Application.java:410)
       at android.app.Activity.dispatchActivityStarted(Activity.java:1480)
       at android.app.Activity.onStart(Activity.java:2014)
       at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1544)
       at android.app.Activity.performStart(Activity.java:8548)
       at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3850)
       at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
       at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2389)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:210)
       at android.os.Looper.loop(Looper.java:299)
       at android.app.ActivityThread.main(ActivityThread.java:8261)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)

Code of Conduct

ipapps commented 10 months ago

Same here, any fix ?

nan-li commented 9 months ago

Hi @gadvaleyrun and @ipapps,

Thank you for submitting this issue, We have made fixes for ConcurrentModificationException and released in Release 5.1.0.

Please update and reach out if you are still seeing issues.