realm-kotlin
realm-kotlin copied to clipboard
Flaky test: [ios] io.realm.test.shared.SyncedRealmTests.canSync
iOS test stage failed in https://ci.realm.io/blue/organizations/jenkins/realm%2Frealm-kotlin/detail/master/297/pipeline with the below stack trace. Haven't been able to reproduce locally and subsequent build succeeded. The succeeding build ran on the same machine and since the server is rebooted pr. test stage it shouldn't be leaking data from other stages ... but I guess the primary key default could be an issue 🤔
[ RUN ] io.realm.test.shared.SyncedRealmTests.canSync
2022-01-18 03:32:59.180 test.kexe[66019:50717365] INFO: [SYNC] Connection[1]: Session[1]: client_reset_config = false, Realm exists = true, client reset = false(null)
2022-01-18 03:32:59.180 test.kexe[66019:50717365] INFO: [SYNC] Connected to endpoint '::1:9090' (from '::1:61012')(null)
2022-01-18 03:32:59.240 test.kexe[66019:50717365] INFO: [SYNC] Connection[2]: Session[2]: client_reset_config = false, Realm exists = true, client reset = false(null)
2022-01-18 03:32:59.241 test.kexe[66019:50717365] INFO: [SYNC] Connected to endpoint '::1:9090' (from '::1:61013')(null)
2022-01-18 03:32:59.305 test.kexe[66019:50717365] INFO: [SYNC] Connection[1]: Disconnected(null)
2022-01-18 03:32:59.305 test.kexe[66019:50717365] INFO: [SYNC] Connection[2]: Disconnected(null)
kotlin.IllegalArgumentException: Cannot create object with existing primary key
Failed to read dyld info for process 66019 (5)
at 0 test.kexe 0x000000010014ad91 kfun:kotlin.Throwable#<init>(kotlin.String?){} + 97
at 1 test.kexe 0x0000000100143c9d kfun:kotlin.Exception#<init>(kotlin.String?){} + 93
at 2 test.kexe 0x0000000100143e3d kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 93
at 3 test.kexe 0x00000001001441dd kfun:kotlin.IllegalArgumentException#<init>(kotlin.String?){} + 93
at 4 test.kexe 0x00000001008a7618 kfun:io.realm.internal#create(io.realm.internal.Mediator;io.realm.internal.RealmReference;kotlin.reflect.KClass<0:0>;kotlin.Any?){0§<io.realm.RealmObject>}0:0 + 2344
at 5 test.kexe 0x00000001008a8bd6 kfun:io.realm.internal#copyToRealm(io.realm.internal.Mediator;io.realm.internal.RealmReference;0:0;kotlin.collections.MutableMap<io.realm.internal.RealmObjectInternal,io.realm.internal.RealmObjectInternal>){0§<kotlin.Any?>}0:0 + 4854
at 6 test.kexe 0x00000001008a9039 kfun:io.realm.internal#copyToRealm$default(io.realm.internal.Mediator;io.realm.internal.RealmReference;0:0;kotlin.collections.MutableMap<io.realm.internal.RealmObjectInternal,io.realm.internal.RealmObjectInternal>?;kotlin.Int){0§<kotlin.Any?>}0:0 + 521
at 7 test.kexe 0x0000000100892c40 kfun:io.realm.internal.MutableRealmImpl#copyToRealm(0:0){0§<io.realm.RealmObject>}0:0 + 448
at 8 test.kexe 0x0000000100115dd1 kfun:io.realm.test.shared.SyncedRealmTests.canSync$lambda-4$lambda-3#internal + 273
at 9 test.kexe 0x00000001001205ae kfun:io.realm.test.shared.SyncedRealmTests.$canSync$lambda-4$lambda-3$FUNCTION_REFERENCE$51.invoke#internal + 206
at 10 test.kexe 0x00000001008b2da2 kfun:io.realm.internal.SuspendableWriter.$write$lambda-2COROUTINE$9.invokeSuspend#internal + 2082
at 11 test.kexe 0x0000000100170200 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 800
at 12 test.kexe 0x000000010046e16e kfun:kotlinx.coroutines.DispatchedTask#run(){} + 3422
at 13 test.kexe 0x00000001003ef87d kfun:kotlinx.coroutines.EventLoopImplBase#processNextEvent(){}kotlin.Long + 941
at 14 test.kexe 0x0000000100493a13 kfun:kotlinx.coroutines#runEventLoop(kotlinx.coroutines.EventLoop?;kotlin.Function0<kotlin.Boolean>){} + 931
at 15 test.kexe 0x000000010049d539 kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.start$lambda-0#internal + 409
at 16 test.kexe 0x000000010049d680 kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.$start$lambda-0$FUNCTION_REFERENCE$35.invoke#internal + 64
at 17 test.kexe 0x000000010049d770 kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.$start$lambda-0$FUNCTION_REFERENCE$35.$<bridge-UNN>invoke(){}#internal + 64
at 18 test.kexe 0x000000010017e9ed WorkerLaunchpad + 205
at 19 test.kexe 0x000000010039e840 _ZN6Worker19processQueueElementEb + 2800
at 20 test.kexe 0x000000010039dd11 _ZN12_GLOBAL__N_113workerRoutineEPv + 81
at 21 libsystem_pthread.dylib 0x00007fff60342950 _pthread_start + 224
at 22 libsystem_pthread.dylib 0x00007fff6033e47b thread_start + 15
[ FAILED ] io.realm.test.shared.SyncedRealmTests.canSync (1033 ms)
Another instance while building 0.8.2 - https://ci.realm.io/job/realm/job/realm-kotlin/job/releases/118/console:
[ RUN ] io.realm.test.shared.SyncedRealmTests.canSync
2022-01-20 03:25:50.677 test.kexe[98828:52275945] INFO: [SYNC] Connection[1]: Session[1]: client_reset_config = false, Realm exists = true, client reset = false(null)
2022-01-20 03:25:50.678 test.kexe[98828:52275945] INFO: [SYNC] Connected to endpoint '::1:9090' (from '::1:64929')(null)
2022-01-20 03:25:50.735 test.kexe[98828:52275945] INFO: [SYNC] Connection[2]: Session[2]: client_reset_config = false, Realm exists = true, client reset = false(null)
2022-01-20 03:25:50.736 test.kexe[98828:52275945] INFO: [SYNC] Connected to endpoint '::1:9090' (from '::1:64930')(null)
2022-01-20 03:25:50.800 test.kexe[98828:52275945] INFO: [SYNC] Connection[1]: Disconnected(null)
2022-01-20 03:25:50.800 test.kexe[98828:52275945] INFO: [SYNC] Connection[2]: Disconnected(null)
kotlin.IllegalArgumentException: Cannot create object with existing primary key
Failed to read dyld info for process 98828 (5)
at 0 test.kexe 0x0000000100cc55b1 kfun:kotlin.Throwable#<init>(kotlin.String?){} + 97
at 1 test.kexe 0x0000000100cbe5fd kfun:kotlin.Exception#<init>(kotlin.String?){} + 93
at 2 test.kexe 0x0000000100cbe79d kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 93
at 3 test.kexe 0x0000000100cbeb3d kfun:kotlin.IllegalArgumentException#<init>(kotlin.String?){} + 93
at 4 test.kexe 0x000000010141ab50 kfun:io.realm.internal#create(io.realm.internal.Mediator;io.realm.internal.RealmReference;kotlin.reflect.KClass<0:0>;kotlin.Any?){0§<io.realm.RealmObject>}0:0 + 1872
at 5 test.kexe 0x000000010141c106 kfun:io.realm.internal#copyToRealm(io.realm.internal.Mediator;io.realm.internal.RealmReference;0:0;kotlin.collections.MutableMap<io.realm.internal.RealmObjectInternal,io.realm.internal.RealmObjectInternal>){0§<kotlin.Any?>}0:0 + 4854
at 6 test.kexe 0x000000010141c569 kfun:io.realm.internal#copyToRealm$default(io.realm.internal.Mediator;io.realm.internal.RealmReference;0:0;kotlin.collections.MutableMap<io.realm.internal.RealmObjectInternal,io.realm.internal.RealmObjectInternal>?;kotlin.Int){0§<kotlin.Any?>}0:0 + 521
at 7 test.kexe 0x0000000101406510 kfun:io.realm.internal.MutableRealmImpl#copyToRealm(0:0){0§<io.realm.RealmObject>}0:0 + 448
at 8 test.kexe 0x0000000100c90891 kfun:io.realm.test.shared.SyncedRealmTests.canSync$lambda-4$lambda-3#internal + 273
at 9 test.kexe 0x0000000100c9b06e kfun:io.realm.test.shared.SyncedRealmTests.$canSync$lambda-4$lambda-3$FUNCTION_REFERENCE$51.invoke#internal + 206
at 10 test.kexe 0x00000001014262d2 kfun:io.realm.internal.SuspendableWriter.$write$lambda-2COROUTINE$9.invokeSuspend#internal + 2082
at 11 test.kexe 0x0000000100ceaa20 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 800
at 12 test.kexe 0x0000000100fe840e kfun:kotlinx.coroutines.DispatchedTask#run(){} + 3422
at 13 test.kexe 0x0000000100f69b1d kfun:kotlinx.coroutines.EventLoopImplBase#processNextEvent(){}kotlin.Long + 941
at 14 test.kexe 0x000000010100dcb3 kfun:kotlinx.coroutines#runEventLoop(kotlinx.coroutines.EventLoop?;kotlin.Function0<kotlin.Boolean>){} + 931
at 15 test.kexe 0x00000001010177d9 kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.start$lambda-0#internal + 409
at 16 test.kexe 0x0000000101017920 kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.$start$lambda-0$FUNCTION_REFERENCE$35.invoke#internal + 64
at 17 test.kexe 0x0000000101017a10 kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.$start$lambda-0$FUNCTION_REFERENCE$35.$<bridge-UNN>invoke(){}#internal + 64
at 18 test.kexe 0x0000000100cf920d WorkerLaunchpad + 205
at 19 test.kexe 0x0000000100f18b40 _ZN6Worker19processQueueElementEb + 2800
at 20 test.kexe 0x0000000100f18011 _ZN12_GLOBAL__N_113workerRoutineEPv + 81
at 21 libsystem_pthread.dylib 0x00007fff60342950 _pthread_start + 224
at 22 libsystem_pthread.dylib 0x00007fff6033e47b thread_start + 15
[ FAILED ] io.realm.test.shared.SyncedRealmTests.canSync (1028 ms)
This also failed here: https://ci.realm.io/blue/organizations/jenkins/realm%2Frealm-kotlin/detail/master/299/pipeline
My best guess is that maybe the Synced Realm files are not placed where we think they are and then not being cleaned up between tests. But this is just a guess.
Another failure here: https://ci.realm.io/blue/organizations/jenkins/realm%2Frealm-kotlin/detail/PR-649/1/pipeline
I separated the canSync data from other tests by adding a partition value in #650, but will leave this open to investigate why this was only failing sometimes on iOS on CI and not being reproducible anywhere else. See further description in #650.
Seems like we are starting to see the same issue in io.realm.test.mongodb.shared.SyncSessionTests.uploadAndDownloadChangesSuccessfully
Observed on both of these PRs after updating to master:
https://ci.realm.io/blue/organizations/jenkins/realm%2Frealm-kotlin/detail/PR-790/6/pipeline/391
https://ci.realm.io/blue/organizations/jenkins/realm%2Frealm-kotlin/detail/PR-789/6/pipeline
I created https://github.com/realm/realm-kotlin/pull/793 as (hopefully) temporary fix for this.
Seems to have gone away