question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flaky test: [ios] io.realm.test.shared.SyncedRealmTests.canSync

See original GitHub issue

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)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cmelchiorcommented, Apr 19, 2022

I created https://github.com/realm/realm-kotlin/pull/793 as (hopefully) temporary fix for this.

0reactions
rorbechcommented, Apr 19, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flaky tests resolving using Test Repetitions in Xcode - SwiftLee
A flaky test is a test that randomly succeeds and randomly fails. In other words: it's an inconsistent test. They can occur on...
Read more >
How to Fix Flaky Tests - Semaphore CI
Randomly failing tests are the hardest to debug. Here's a framework you can use to fix them and keep your test suite healthy....
Read more >
Xcode 13 — Retry failed tests to handle flaky tests
We all have come across certain stubborn flaky tests that fail due to circumstances beyond our control. ... #2 — Using retry failed...
Read more >
Solving flaky tests by making use of Xcode on virtual machines
Antoine van der Lee explains how Xcode got better over the years when it comes to testing and how you can solve flaky...
Read more >
Same UI Testing fail with iOS simu… | Apple Developer Forums
I'm in a big project app with unit testing and ui testing running well. Recently, one member of team, buy a MacBook Pro...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found