-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
SDK and version
SDK : Swift (SPM)
Version: 10.39.1 (RealmDatabase: 13.10.1)
Observations
- How frequent do the crash occur? Randomly, indeterminate
- Does it happen in production or during dev/test? dev, but assumedly also in production
- Can the crash be reproduced by you? Not consistently
- Can you provide instructions for how we can reproduce it? No
Crash log / stacktrace
/Users/xxx/Library/Developer/Xcode/DerivedData/xxx/checkouts/realm-core/src/realm/object-store/impl/realm_coordinator.cpp:1109: [realm-core-13.10.1] Assertion failed: !realm.is_in_transaction() 0 DevApp 0x00000001052f48e8 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28 1 DevApp 0x00000001052f48c8 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 308 2 DevApp 0x00000001052f4794 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 0 3 DevApp 0x0000000104d32d98 _ZN5realm5_impl16RealmCoordinator16promote_to_writeERNS_5RealmE + 88 4 DevApp 0x0000000104e5f0ac _ZN5realm5Realm20do_begin_transactionEv + 56 5 DevApp 0x0000000104e5eca4 _ZN5realm5Realm10run_writesEv + 204 6 DevApp 0x0000000104d4b80c _ZN5realm5Realm8Internal10run_writesERS0_ + 24 7 DevApp 0x0000000104d4b7e8 _ZZZN5realm5_impl16RealmCoordinator25async_request_write_mutexERNS_5RealmEEN3$_9clEvENKUlvE_clEv + 28 8 DevApp 0x0000000104d4b7c0 _ZN5realm4util14UniqueFunctionIFvvEE17call_regular_voidIZZNS_5_impl16RealmCoordinator25async_request_write_mutexERNS_5RealmEEN3$_9clEvEUlvE_EEvNSt3__117integral_constantIbLb1EEERT_ + 24 9 DevApp 0x0000000104d4b720 _ZN5realm4util14UniqueFunctionIFvvEE12SpecificImplIZZNS_5_impl16RealmCoordinator25async_request_write_mutexERNS_5RealmEEN3$_9clEvEUlvE_E4callEv + 28 10 DevApp 0x00000001048d6b98 _ZNK5realm4util14UniqueFunctionIFvvEEclEv + 100 11 DevApp 0x00000001048d6ac8 ___ZN12_GLOBAL__N_114ActorScheduler6invokeEON5realm4util14UniqueFunctionIFvvEEE_block_invoke + 52 12 DevApp 0x00000001049a16c0 $sIeyB_Ieg_TR + 16 13 DevApp 0x00000001049c7abc $sIeg_ytIegr_TR + 20 14 DevApp 0x0000000104a0f4dc $sytIeghr_Iegh_TR + 20 15 DevApp 0x0000000104a0f6d8 $sScA10RealmSwiftE8doInvoke33_3EEC705E1F715BCD31B1A87960A34A90LLyyyyYbXEF + 64 16 DevApp 0x0000000104a0f5fc $sScA10RealmSwiftE6invokeyyyycFyyYaYbcfU_TY0_ + 100 17 libswift_Concurrency.dylib 0x000000010c1f9a38 _ZN5swift34runJobInEstablishedExecutorContextEPNS_3JobE + 304 18 libswift_Concurrency.dylib 0x000000010c1fb104 _ZN12_GLOBAL__N_119ProcessOutOfLineJob7processEPN5swift3JobE + 852 19 libswift_Concurrency.dylib 0x000000010c1f9abc _ZN5swift34runJobInEstablishedExecutorContextEPNS_3JobE + 436 20 libswift_Concurrency.dylib 0x000000010c1fa704 _ZL17swift_job_runImplPN5swift3JobENS_11ExecutorRefE + 80 21 libdispatch.dylib 0x000000010d468fac _dispatch_continuation_pop + 152 22 libdispatch.dylib 0x000000010d468188 _dispatch_async_redirect_invoke + 904 23 libdispatch.dylib 0x000000010d47a900 _dispatch_root_queue_drain + 440 24 libdispatch.dylib 0x000000010d47b574 _dispatch_worker_thread2 + 248 25 libsystem_pthread.dylib 0x000000010de638c0 _pthread_wqthread + 224 26 libsystem_pthread.dylib 0x000000010de626c0 start_wqthread + 8 !!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose2023-05-23 15:27:47.584056+0200 DevApp[25066:28904398] /Users/xxx/Library/Developer/Xcode/DerivedData/xxx/checkouts/realm-core/src/realm/object-store/impl/realm_coordinator.cpp:1109: [realm-core-13.10.1] Assertion failed: !realm.is_in_transaction() 0 DevApp 0x00000001052f48e8 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28 1 DevApp 0x00000001052f48c8 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 308 2 DevApp 0x00000001052f4794 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 0 3 DevApp 0x0000000104d32d98 _ZN5realm5_impl16RealmCoordinator16promote_to_writeERNS_5RealmE + 88 4 DevApp 0x0000000104e5f0ac _ZN5realm5Realm20do_begin_transactionEv + 56 5 DevApp 0x0000000104e5eca4 _ZN5realm5Realm10run_writesEv + 204 6 DevApp 0x0000000104d4b80c _ZN5realm5Realm8Internal10run_writesERS0_ + 24 7 DevApp 0x0000000104d4b7e8 _ZZZN5realm5_impl16RealmCoordinator25async_request_write_mutexERNS_5RealmEEN3$_9clEvENKUlvE_clEv + 28 8 DevApp 0x0000000104d4b7c0 _ZN5realm4util14UniqueFunctionIFvvEE17call_regular_voidIZZNS_5_impl16RealmCoordinator25async_request_write_mutexERNS_5RealmEEN3$_9clEvEUlvE_EEvNSt3__117integral_constantIbLb1EEERT_ + 24 9 DevApp 0x0000000104d4b720 _ZN5realm4util14UniqueFunctionIFvvEE12SpecificImplIZZNS_5_impl16RealmCoordinator25async_request_write_mutexERNS_5RealmEEN3$_9clEvEUlvE_E4callEv + 28 10 DevApp 0x00000001048d6b98 _ZNK5realm4util14UniqueFunctionIFvvEEclEv + 100 11 DevApp 0x00000001048d6ac8 ___ZN12_GLOBAL__N_114ActorScheduler6invokeEON5realm4util14UniqueFunctionIFvvEEE_block_invoke + 52 12 DevApp 0x00000001049a16c0 $sIeyB_Ieg_TR + 16 13 DevApp 0x00000001049c7abc $sIeg_ytIegr_TR + 20 14 DevApp 0x0000000104a0f4dc $sytIeghr_Iegh_TR + 20 15 DevApp 0x0000000104a0f6d8 $sScA10RealmSwiftE8doInvoke33_3EEC705E1F715BCD31B1A87960A34A90LLyyyyYbXEF + 64 16 DevApp 0x0000000104a0f5fc $sScA10RealmSwiftE6invokeyyyycFyyYaYbcfU_TY0_ + 100 17 libswift_Concurrency.dylib 0x000000010c1f9a38 _ZN5swift34runJobInEstablishedExecutorContextEPNS_3JobE + 304 18 libswift_Concurrency.dylib 0x000000010c1fb104 _ZN12_GLOBAL__N_119ProcessOutOfLineJob7processEPN5swift3JobE + 852 19 libswift_Concurrency.dylib 0x000000010c1f9abc _ZN5swift34runJobInEstablishedExecutorContextEPNS_3JobE + 436 20 libswift_Concurrency.dylib 0x000000010c1fa704 _ZL17swift_job_runImplPN5swift3JobENS_11ExecutorRefE + 80 21 libdispatch.dylib 0x000000010d468fac _dispatch_continuation_pop + 152 22 libdispatch.dylib 0x000000010d468188 _dispatch_async_redirect_invoke + 904 23 libdispatch.dylib 0x000000010d47a900 _dispatch_root_queue_drain + 440 24 libdispatch.dylib 0x000000010d47b574 _dispatch_worker_thread2 + 248 25 libsystem_pthread.dylib 0x000000010de638c0 _pthread_wqthread + 224 26 libsystem_pthread.dylib 0x000000010de626c0 start_wqthread + 8 !!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose
Steps & Code to Reproduce
It's hard to reproduce this error consistently, although I do get this (and other assertion failures) while randomly clicking through the app.
Most of the Realm-related code (specifically writing) has migrated to the new Actor-isolated realm instances, using asyncWrite(_, however some parts may still use the older method (usually just try! Realm()). Concretely, anytime a view requires a realm object, it is retrieved using the old method (on the main actor). Is it possible that this is the cause of the issue?