realm-swift: Assertion failed: previous <= m_schema_transaction_version_max

Goals

Everytime I launch my app on a new simulator I see this crash. When I launch the simulator the second time the app runs fine. I want to identify reason for crash.

Expected Results

This crash started after updating to RealmSwift 2.5.1. What seems to be the reason for this crash?

The crash does not happen on a simulator where the app is already installed and the crash does not happen if I select ‘Reset Content and Settings’. Only on initial launch… EDIT: It does seem to crash after ‘Reset Content and Settings’ on the simulator.

Actual Results

Crashes on initial launch of a newly selected iOS simulator with the following stack trace:

/Pods/Realm/Realm/ObjectStore/src/impl/realm_coordinator.cpp:289: [realm-core-2.5.1] Assertion failed: previous <= m_schema_transaction_version_max
0   Realm                               0x0000000105df6af8 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 40
1   Realm                               0x0000000105df6df5 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 517
2   Realm                               0x0000000105abc453 _ZN5realm5_impl16RealmCoordinator20advance_schema_cacheEyy + 371
3   Realm                               0x0000000105cdd98d _ZN5realm5Realm16cache_new_schemaEv + 349
4   Realm                               0x0000000105cde3f3 _ZN5realm5Realm17begin_transactionEv + 787
5   Realm                               0x0000000105c82d0e -[RLMRealm beginWriteTransaction] + 46
6   RealmSwift                          0x00000001064c418d _TFC10RealmSwift5Realm10beginWritefT_T_ + 45
7   RealmSwift                          0x00000001064c4070 _TFC10RealmSwift5Realm5writefzFzT_T_T_ + 48
8   appName                            0x0000000104c19d33 _TZFe8AppNameRxC10RealmSwift6ObjectxS_17ClassAsPrimaryKeyxS_16GetNewOrExistingrS3_16getNewOrExistingfzSbT6objectx10createdNewSb_ + 1123
9   appName                            0x0000000104cf9fb1 _TFC8appName11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 14193
10  appName                            0x0000000104cfcc44 _TToFC8appName11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 180
11  UIKit                               0x0000000106ee0957 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 299
12  UIKit                               0x0000000106ee223c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4119
13  UIKit                               0x0000000106ee8584 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1709
14  UIKit                               0x0000000106ee5793 -[UIApplication workspaceDidEndTransaction:] + 182
15  FrontBoardServices                  0x000000010f4065f6 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
16  FrontBoardServices                  0x000000010f40646d -[FBSSerialQueue _performNext] + 186
17  FrontBoardServices                  0x000000010f4067f6 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
18  CoreFoundation                      0x000000010b52ac01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
19  CoreFoundation                      0x000000010b5100cf __CFRunLoopDoSources0 + 527
20  CoreFoundation                      0x000000010b50f5ff __CFRunLoopRun + 911
21  CoreFoundation                      0x000000010b50f016 CFRunLoopRunSpecific + 406
22  UIKit                               0x0000000106ee402f -[UIApplication _run] + 468
23  UIKit                               0x0000000106eea0d4 UIApplicationMain + 159
24  appName                            0x0000000104d0da97 main + 55
25  libdyld.dylib                       0x000000010c86465d start + 1
26  ???                                 0x0000000000000001 0x0 + 1

Steps to Reproduce

I do not know how to reproduce unfortunately.

Version of Realm and Tooling

  • Realm framework version: 2.5.1
  • Realm Object Server version: N/A
  • Xcode version: 8.3
  • iOS/OSX version: 10.3
  • Dependency manager + version: CocoaPods: ?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 23 (7 by maintainers)

Most upvoted comments

also seeing this in 3.21.0 and xcode 11.2. sent the debug report to help @ realm

I also see this on 3.21.0 and Xcode 11.

@bmunkholm I can start a new issue if you like, but this one was definitely my fault. I was just posting to let other’s know what to avoid.

In case it helps anyone, I also got this issue. I was running a migration in RealmJS, but also accessing items with RealmSwift at the same time to back them up to iCloud. I needed to wait until the migration completed before starting the Realm in Swift.

@DPigramIBM,

We are using: Realm.Configuration.defaultConfiguration.fileURL?.absoluteString ?? "NONE" to define the filePath of the RealmDB.

I am also seeing this issue sometimes in my project but I don’t have definitive repro steps.

Hello, i’ve had the same issues when I launch my app with the last version of Realm ObjC on a new simulator for the first time.

After some transaction, I have ‘previous’ = 5 et ‘m_schema_transaction_version_max’ = 4 when it comes to the lines:

REALM_ASSERT(previous <= m_schema_transaction_version_max);

this is the stack trace, i have :

 /Pods/Realm/Realm/ObjectStore/src/impl/realm_coordinator.cpp:289: [realm-core-2.6.2] Assertion failed: previous <= m_schema_transaction_version_max
0   []               0x00a2db90 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 48
1   []               0x00a2dfbc _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 492
2   []               0x005b25e1 _ZN5realm5_impl16RealmCoordinator20advance_schema_cacheEyy + 401
3   []               0x007e9115 _ZN5realm5Realm16cache_new_schemaEv + 325
4   []               0x007e93b0 _ZN5realm5Realm18commit_transactionEv + 384
5   []               0x0077aaeb -[RLMRealm commitWriteTransaction:] + 59
6   []               0x0077b109 -[RLMRealm transactionWithBlock:error:] + 185
7   []               0x00344553 +[] + 307
8   []               0x00090ce2 +[] + 98
9   []               0x00363bfb -[] + 139
10  []               0x003636b7 __35-[]_block_invoke_2 + 311
11  []               0x0020ea70 __42+[]_block_invoke + 304
12  []               0x003a662b __116-[AFHTTPSessionManager dataTaskWithHTTPMethod:URLString:parameters:uploadProgress:downloadProgress:success:failure:]_block_invoke.97 + 219
13  []               0x003ccb59 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2.150 + 217
14  libdispatch.dylib                   0x0705e377 _dispatch_call_block_and_release + 15
15  libdispatch.dylib                   0x070819cd _dispatch_client_callout + 14
16  libdispatch.dylib                   0x07066f90 _dispatch_main_queue_callback_4CF + 910
17  CoreFoundation                      0x067975fe __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
18  CoreFoundation                      0x067552f4 __CFRunLoopRun + 2356
19  CoreFoundation                      0x06754706 CFRunLoopRunSpecific + 470
20  CoreFoundation                      0x0675451b CFRunLoopRunInMode + 123
21  GraphicsServices                    0x094c6664 GSEventRunModal + 192
22  GraphicsServices                    0x094c64a1 GSEventRun + 104
23  UIKit                               0x03b2d1eb UIApplicationMain + 160
24  []               0x003a082c main + 140
25  libdyld.dylib                       0x070aba21 start + 1
26  ???                                 0x00000001 0x0 + 1