realm / realm-kotlin

Kotlin Multiplatform and Android SDK for the Realm Mobile Database: Build Better Apps Faster.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ConcurrentModificationException

XilinJia opened this issue · comments

How frequently does the bug occur?

Sometimes

Description

copyToRealm(entity, UpdatePolicy.ALL)?.let {
   doSomething(it)
}

```it crashed on line copyToRealm(entity, UpdatePolicy.ALL)?.let

### Stacktrace & log output

```shell
java.util.ConcurrentModificationException
                                                                                                    	at java.util.ArrayList$Itr.next(ArrayList.java:860)
                                                                                                    	at io.realm.kotlin.internal.ListOperator$DefaultImpls.insertAll(RealmListInternal.kt:234)
                                                                                                    	at io.realm.kotlin.internal.BaseRealmObjectListOperator.insertAll(RealmListInternal.kt:307)
                                                                                                    	at io.realm.kotlin.internal.RealmObjectHelper.assignTyped$io_realm_kotlin_library(RealmObjectHelper.kt:801)
                                                                                                    	at io.realm.kotlin.internal.RealmObjectHelper.assign$io_realm_kotlin_library(RealmObjectHelper.kt:734)
                                                                                                    	at io.realm.kotlin.internal.RealmUtilsKt.copyToRealm(RealmUtils.kt:220)
                                                                                                    	at io.realm.kotlin.internal.RealmObjectHelper.assignTyped$io_realm_kotlin_library(RealmObjectHelper.kt:2425)
                                                                                                    	at io.realm.kotlin.internal.RealmObjectHelper.assign$io_realm_kotlin_library(RealmObjectHelper.kt:734)
                                                                                                    	at io.realm.kotlin.internal.RealmUtilsKt.copyToRealm(RealmUtils.kt:220)
                                                                                                    	at io.realm.kotlin.internal.RealmUtilsKt.copyToRealm$default(RealmUtils.kt:144)
                                                                                                    	at io.realm.kotlin.internal.InternalMutableRealm$DefaultImpls.copyToRealm(InternalMutableRealm.kt:57)
                                                                                                    	at io.realm.kotlin.internal.SuspendableWriter$WriterRealm.copyToRealm(SuspendableWriter.kt:58)


### Can you reproduce the bug?

Sometimes

### Reproduction Steps

_No response_

### Version

1.16.0

### What Atlas App Services are you using?

Local Database only

### Are you using encryption?

No

### Platform OS and version(s)

Android 9

### Build environment

Android Studio version: Intellij 2024.1.2
Android Build Tools version: SDK 34
Gradle version: 8.5

➤ PM Bot commented:

Jira ticket: RKOTLIN-1097

Can you provide a code snippet which shows how you use copyToRealm?

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.