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

java.util.ConcurrentModificationException in Peripheral.asWritableMap on Android 14 #1229

Open
vhakulinen opened this issue Jun 6, 2024 · 1 comment
Labels

Comments

@vhakulinen
Copy link
Contributor

Describe the bug

There is an concurrent usage issue with the Peripheral.asWritableMap on Android 14.

To Reproduce

Haven't been able to reproduce yet.

Expected behavior

To to throw such exception.

Smartphone (please complete the following information):

  • Device: -
  • OS: Android 14

Additional context

Stacktrace

Exception java.util.ConcurrentModificationException:
  at java.util.ArrayList$Itr.checkForComodification (ArrayList.java:1029)
  at java.util.ArrayList$Itr.next (ArrayList.java:982)
  at android.bluetooth.BluetoothGatt.getServices (BluetoothGatt.java:1437)
  at it.innove.Peripheral.asWritableMap (Peripheral.java:223)
  at it.innove.Peripheral.lambda$onServicesDiscovered$2 (Peripheral.java:298)
  at it.innove.Peripheral.$r8$lambda$68IZVZOPb-h7ZTf0nnf3p8RiFZ4
  at it.innove.Peripheral$$ExternalSyntheticLambda17.run
  at android.os.Handler.handleCallback (Handler.java:958)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:230)
  at android.os.Looper.loop (Looper.java:319)
  at android.app.ActivityThread.main (ActivityThread.java:8919)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:578)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)

There is some good explanation about this exception here: https://stackoverflow.com/a/55141359

I'm not sure if using the for (it : iterator) syntax would help here.

@lucaswitch
Copy link
Contributor

Describe the bug

There is an concurrent usage issue with the Peripheral.asWritableMap on Android 14.

To Reproduce

Haven't been able to reproduce yet.

Expected behavior

To to throw such exception.

Smartphone (please complete the following information):

  • Device: -
  • OS: Android 14

Additional context

Stacktrace

Exception java.util.ConcurrentModificationException:
  at java.util.ArrayList$Itr.checkForComodification (ArrayList.java:1029)
  at java.util.ArrayList$Itr.next (ArrayList.java:982)
  at android.bluetooth.BluetoothGatt.getServices (BluetoothGatt.java:1437)
  at it.innove.Peripheral.asWritableMap (Peripheral.java:223)
  at it.innove.Peripheral.lambda$onServicesDiscovered$2 (Peripheral.java:298)
  at it.innove.Peripheral.$r8$lambda$68IZVZOPb-h7ZTf0nnf3p8RiFZ4
  at it.innove.Peripheral$$ExternalSyntheticLambda17.run
  at android.os.Handler.handleCallback (Handler.java:958)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:230)
  at android.os.Looper.loop (Looper.java:319)
  at android.app.ActivityThread.main (ActivityThread.java:8919)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:578)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)

There is some good explanation about this exception here: https://stackoverflow.com/a/55141359

I'm not sure if using the for (it : iterator) syntax would help here.

Sorry for the late response.
Thank you for providing the stack trace for it.
Addressed this issue on pr #1264 with a quick fix.

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

No branches or pull requests

3 participants