OneSignal / OneSignal-Cordova-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Ionic, PhoneGap CLI, PhoneGap Build, Cordova, or Sencha Touch app with OneSignal. Supports Android, iOS, and Amazon's Fire OS platforms. https://onesignal.com
Other
251 stars 199 forks source link

[Bug]: java.util.ConcurrentModificationException #954

Closed christiaan closed 7 months ago

christiaan commented 11 months ago

What happened?

The app completely crashes

Steps to reproduce?

We migrated from version 3.x to 5.x

Replaced `setAppId` with `initialize`.
Replaced `setNotificationOpenedHandler` with `click` event listener on Notifications.
Replaced `addSubscriptionObserver` with `change` event listener on User.pushSubscription.
And at the end added the requestPermission call.

What did you expect to happen?

No crash

OneSignal Cordova SDK version

5.0.4

Which platform(s) are affected?

Relevant log output

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.EventProducer.fire (EventProducer.kt:49)
  at com.onesignal.core.internal.application.impl.ApplicationService.setCurrent (ApplicationService.kt:50)
  at com.onesignal.core.internal.application.impl.ApplicationService.onActivityStarted (ApplicationService.kt:150)
  at android.app.Application.dispatchActivityStarted (Application.java:420)
  at android.app.Activity.dispatchActivityStarted (Activity.java:1451)
  at android.app.Activity.onStart (Activity.java:1969)
  at android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1510)
  at android.app.Activity.performStart (Activity.java:8616)
  at android.app.ActivityThread.handleStartActivity (ActivityThread.java:4204)
  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:2574)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8757)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)

Code of Conduct

jennantilla commented 11 months ago

Thank you for this report, @christiaan. We are already investigating this crash happening in the same place as your stack trace. We will let you know when a fix is ready!

Sergeo-sel commented 11 months ago

@jennantilla Hello! Do you have any update on this issue?

christiaan commented 10 months ago

@jennantilla can you link the issue in which that bug is tracked?

bartvanvelden commented 10 months ago

@jennantilla is there a way to speed this up? Without a short solution timeline I have to consider moving to some OneSignal alternative.

bartvanvelden commented 10 months ago

@brayden-onesignal can you help out here?

bartvanvelden commented 10 months ago

or @gdeglin what can we do to get this fixed?

jennantilla commented 7 months ago

Hello everyone! Apologies that these responses were missed. In case you missed it, the ConcurrentModificationExceptions were resolved in Q1. Please update to our latest SDK version. If you have any further questions or concerns, please let us know!