element-android icon indicating copy to clipboard operation
element-android copied to clipboard

RoomDecryptorProvider.getOrCreateRoomDecryptor.onNewSession ConcurrentModificationException

Open ouchadam opened this issue 3 years ago • 4 comments

java.util.ConcurrentModificationException: 
  at java.util.ArrayList$Itr.next (ArrayList.java:860)
  at org.matrix.android.sdk.internal.crypto.RoomDecryptorProvider$getOrCreateRoomDecryptor$alg$1$1.onNewSession (RoomDecryptorProvider.kt:3)
  at org.matrix.android.sdk.internal.crypto.algorithms.megolm.MXMegolmDecryption.onNewSession (MXMegolmDecryption.kt:5)
  at org.matrix.android.sdk.internal.crypto.algorithms.megolm.MXMegolmDecryption.onRoomKeyEvent (MXMegolmDecryption.kt:86)
  at org.matrix.android.sdk.internal.crypto.DefaultCryptoService$onToDeviceEvent$1.invokeSuspend (DefaultCryptoService.kt:171)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:3)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:18)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:233)
  at android.os.HandlerThread.run (HandlerThread.java:67)
Occurrences (30 days) Total Occurrences Impacted users (lifetime)
29 29 28

https://play.google.com/console/u/0/developers/{redacted}/app/{redacted}/vitals/crashes/6bfcddc1/details?installedFrom=PLAY_STORE&days=30

ouchadam avatar Apr 12 '22 16:04 ouchadam

Looks like the fix is not enough, see https://github.com/matrix-org/element-android-rageshakes/issues/42693. Reopening.

Maybe using CopyOnWriteArrayList or CopyOnWriteArraySet is a better solution.

bmarty avatar Sep 07 '22 12:09 bmarty

@bmarty the ConcurrentModificationException crash in this rageshake is coming from 1.4.11

The crash occurred on 08-24 14:06:44.555 with 1.4.11 but the rageshake was sent at 2022-09-07T07:56:31 on 1.4.34

ouchadam avatar Sep 12 '22 10:09 ouchadam

Still experiencing the same here 🙋🏻‍♂️

danpe avatar May 18 '23 11:05 danpe

Still experiencing the same here 🙋🏻‍♂️

We have a bit different stacktrace, but also believe that the reason must be the same.

java.util.ConcurrentModificationException
  at java.util.ArrayList$Itr.next([ArrayList.java:860](http://arraylist.java:860/))
  at [org.matrix.android](http://org.matrix.android/).sdk.internal.crypto.IncomingKeyRequestManager$processIncomingRequests$1$1.invokeSuspend(IncomingKeyRequestManager.kt:97)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:9)
  at [kotlinx.coroutines.j0.run](http://kotlinx.coroutines.j0.run/)(DispatchedTask.kt:107)
  at java.util.concurrent.ThreadPoolExecutor.runWorker([ThreadPoolExecutor.java:1137](http://threadpoolexecutor.java:1137/))
  at java.util.concurrent.ThreadPoolExecutor$Worker.run([ThreadPoolExecutor.java:637](http://threadpoolexecutor.java:637/))
  at [java.lang.Thread.run](http://java.lang.thread.run/)([Thread.java:1012](http://thread.java:1012/))
  Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [s1{Cancelling}@c08de01, java.util.concurrent.Executors$FinalizableDelegatedExecutorService@7adbee7]

pepperoni666 avatar May 18 '23 11:05 pepperoni666