Reported by a user from HelpScout:
https://secure.helpscout.net/conversation/381267285/10294/?folderId=440773
Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp:358: [realm-core-2.8.1] Assertion failed: m_schema_version != ObjectStore::NotVersioned
0 Realm 0x00000001042c23d0 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 44
1 Realm 0x00000001042c26a8 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 388
2 Realm 0x00000001040c1e04 _ZN5realm5Realm17set_schema_subsetENS_6SchemaE + 312
3 Realm 0x000000010400d704 +[RLMRealm realmWithConfiguration:error:] + 5476
4 RealmSwift 0x00000001055b489c _TTOFCSo8RLMRealmCfzT13configurationCSo21RLMRealmConfiguration_S_ + 160
5 RealmSwift 0x00000001055b4b8c _TFC10RealmSwift5RealmcfzT13configurationVS0_13Configuration_S0_ + 600
6 RealmSwift 0x00000001055b4f38 _TFC10RealmSwift5RealmCfzT13configurationVS0_13Configuration_S0_ + 488
7 0x00000001006adfd4 _TFFFC1214KMRealmManager6updateFT6objectCS_8MFYImage6paramsGVs10DictionarySSP___T_U_FT_T_U_FT_T_ + 640
8 0x00000001006ae138 _TTRXFo__zoPs5Error__XFo__iT_zoPS___ + 36
9 libswiftObjectiveC.dylib 0x00000001061196b4 _TF10ObjectiveC15autoreleasepoolurFzT8invokingFzT_x_x + 68
10 0x00000001006adc5c _TFFC1214KMRealmManager6updateFT6objectCS_8MFYImage6paramsGVs10DictionarySSP___T_U_FT_T_ + 240
11 0x000000010057fde8 _TTRXFo___XFdCb___ + 44
12 libdispatch.dylib 0x0000000180fa5200 <redacted> + 24
13 libdispatch.dylib 0x0000000180fa51c0 <redacted> + 16
14 libdispatch.dylib 0x0000000180fb3444 <redacted> + 928
15 libdispatch.dylib 0x0000000180fa89a8 <redacted> + 652
16 libdispatch.dylib 0x0000000180fb538c <redacted> + 572
17 libdispatch.dylib 0x0000000180fb50ec <redacted> + 124
18 libsystem_pthread.dylib 0x00000001811ae2b8 _pthread_wqthread + 1288
19 libsystem_pthread.dylib 0x00000001811adda4 start_wqthread + 4
IMPORTANT: if you see this error, please send this log to [email protected].
Hello, We have also encountered similar issue at our end.
Realm Version: 2.8.3
Encryption: On
/Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp:358: [realm-core-2.8.1] Assertion failed: m_schema_version != ObjectStore::NotVersioned
0 Realm 0x032db950 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 48
1 Realm 0x032dbd0c _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 492
2 Realm 0x031aaa8b _ZN5realm5Realm17set_schema_subsetENS_6SchemaE + 283
3 Realm 0x03139490 +[RLMRealm realmWithConfiguration:error:] + 4464
4 RealmSwift 0x039ae9d6 _TTOFCSo8RLMRealmCfzT13configurationCSo21RLMRealmConfiguration_S_ + 166
5 RealmSwift 0x039aed6a _TFC10RealmSwift5RealmcfzT13configurationVS0_13Configuration_S0_ + 778
6 RealmSwift 0x039af219 _TFC10RealmSwift5RealmCfzT13configurationVS0_13Configuration_S0_ + 505
<REDACTED>
14 libswiftObjectiveC.dylib 0x0726a491 _TF10ObjectiveC15autoreleasepoolurFzT8invokingFzT_x_x + 49
<REDACTED>
18 libdispatch.dylib 0x0743cf05 _dispatch_call_block_and_release + 15
19 libdispatch.dylib 0x07467cc9 _dispatch_client_callout + 14
20 libdispatch.dylib 0x07448517 _dispatch_root_queue_drain + 1635
21 libdispatch.dylib 0x07447e4c _dispatch_worker_thread3 + 138
22 libsystem_pthread.dylib 0x077c6c7a _pthread_wqthread + 1070
23 libsystem_pthread.dylib 0x077c6826 start_wqthread + 34
IMPORTANT: if you see this error, please send this log to [email protected].
/Users/yizhongzhuang/Desktop/github/xmail/XMail/Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp:361: [realm-core-2.8.6] Assertion failed: m_schema_version != ObjectStore::NotVersioned
0 Realm 0x000000010ec86b78 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 40
1 Realm 0x000000010ec86f05 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 517
2 Realm 0x000000010ea13c2c _ZN5realm5Realm17set_schema_subsetENS_6SchemaE + 332
3 Realm 0x000000010e920ea4 +[RLMRealm realmWithConfiguration:error:] + 7012
4 RealmSwift 0x0000000110201caa _T0So8RLMRealmCABSo0A13ConfigurationC13configuration_tKcfCTO + 138
5 RealmSwift 0x0000000110201b34 _T010RealmSwift0A0CACyKcfc + 100
6 RealmSwift 0x0000000110201a66 _T010RealmSwift0A0CACyKcfC + 54
7 XMail 0x000000010c38bc33 _T05XMail12StoreManagerC7myRealm33_5B725453E0E39D06960D24A54ED5900ELL0E5Swift0E0CSgvg + 83
8 XMail 0x000000010c38dd59 _T05XMail12StoreManagerC6objectxSgxm6ofType_q_13forPrimaryKeyt10RealmSwift6ObjectCRbzr0_lF + 105
9 XMail 0x000000010c5e31e9 _T05XMail4MailC4mailACSgSS4with_tFZ + 201
10 XMail 0x000000010c5e5a0e _T05XMail4MailC8addMailsySayACG_SS2toyycSg8completetFZyycfU_yACcfU0_ + 110
11 XMail 0x000000010c5e6159 _T05XMail4MailCs5Error_pIgxzo_ACsAD_pIgizo_TR + 25
12 XMail 0x000000010c5ee48b _T05XMail4MailCs5Error_pIgxzo_ACsAD_pIgizo_TRTA + 27
13 libswiftCore.dylib 0x000000011896f54f _T0s8SequencePsE7forEachyy7ElementQzKcKFTf4gn_n + 351
14 libswiftCore.dylib 0x000000011889749d _T0s8SequencePsE7forEachyy7ElementQzKcKFTm + 13
15 libswiftCore.dylib 0x0000000118775700 _T0s8SequencePsE7forEachyy7ElementQzKcKF + 16
16 XMail 0x000000010c5e567d _T05XMail4MailC8addMailsySayACG_SS2toyycSg8completetFZyycfU_ + 413
17 XMail 0x000000010c5ee351 _T05XMail4MailC8addMailsySayACG_SS2toyycSg8completetFZyycfU_TA + 33
18 XMail 0x000000010c2bc9fd _T0Ieg_IeyB_TR + 45
19 libdispatch.dylib 0x000000011933d73b _dispatch_call_block_and_release + 12
20 libdispatch.dylib 0x000000011933e779 _dispatch_client_callout + 8
21 libdispatch.dylib 0x00000001193461b2 _dispatch_queue_serial_drain + 735
22 libdispatch.dylib 0x00000001193469af _dispatch_queue_invoke + 321
23 libdispatch.dylib 0x0000000119348cf8 _dispatch_root_queue_drain + 473
24 libdispatch.dylib 0x0000000119348ac1 _dispatch_worker_thread3 + 119
25 libsystem_pthread.dylib 0x0000000119902169 _pthread_wqthread + 1387
26 libsystem_pthread.dylib 0x0000000119901be9 start_wqthread + 13
IMPORTANT: if you see this error, please send this log to [email protected].
realm Version: 3.19.0
/Users/ramsey/Work/Codes/esv/Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp:433: [realm-core-5.23.5] Assertion failed: m_schema_version != ObjectStore::NotVersioned
0 Realm 0x0000000107be57dc _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 Realm 0x0000000107be5a3c _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 324
2 Realm 0x000000010791e25c _ZN5realm5Realm17set_schema_subsetENS_6SchemaE + 176
3 Realm 0x000000010785ab94 +[RLMRealm realmWithConfiguration:error:] + 1600
4 RealmSwift 0x0000000108dbe324 $sSo8RLMRealmC13configurationABSo0A13ConfigurationC_tKcfCTO + 148
5 RealmSwift 0x0000000108dbe4b0 $s10RealmSwift0A0C13configurationA2C13ConfigurationV_tKcfC + 200
6 ESV 0x0000000104b2773c $s3ESV11RealmHelperC5realm0B5Swift0B0CyF + 200
7 ESV 0x0000000104b27e78 $s3ESV11RealmHelperC10getObjects_12filterString0B5Swift7ResultsCyxGSgxm_SSSgtAF6ObjectCRbzlF + 292
8 ESV 0x0000000104ea60d0 $s3ESV7UtilityC8getTokenSSSgyF + 1636
9 ESV 0x0000000104934990 $s3ESV10NetworkAPIO5tokenSSSgvg + 104
10 ESV 0x00000001049344c0 $s3ESV10NetworkAPIO7headersSDyS2SGSgvg + 864
11 ESV 0x00000001049358d8 $s3ESV11RequestablePAASo8NSObjectCRbzrlE25setupNetworkComponentWith6netapi7mapType18mappedObjectHandle8moreInfo12isBackgroundyAA0E3APIO_qd__myqd__cSgyAA9CSMessageO_SbtcSgSbt0L6Mapper8MappableRd__lFySb_SS_SSttcfU_ + 1264
12 ESV 0x0000000104935f68 $s3ESV11RequestablePAASo8NSObjectCRbzrlE25setupNetworkComponentWith6netapi7mapType18mappedObjectHandle8moreInfo12isBackgroundyAA0E3APIO_qd__myqd__cSgyAA9CSMessageO_SbtcSgSbt0L6Mapper8MappableRd__lFySb_SS_SSttcfU_TA + 116
13 ESV 0x000000010493aef8 $s3ESV11RequestablePAASo8NSObjectCRbzrlE13isNeedRequest3for10completionyAA10NetworkAPIO_ySb_SS_SSttctFy5Cache6ResultOySSGcfU1_Tf2nni_n + 1620
14 ESV 0x000000010493afe0 $s5Cache6ResultOySSGIegg_ADIegn_TR + 64
15 Cache 0x000000010617a6d4 $s5Cache12AsyncStorageC6object6forKey10completionySS_yAA6ResultOyxGctFyAHyAA5EntryVyxGGcfU_ + 288
16 Cache 0x00000001061785dc $s5Cache12AsyncStorageC5entry6forKey10completionySS_yAA6ResultOyAA5EntryVyxGGctFyycfU_ + 1196
17 Cache 0x0000000106178710 $sIeg_IeyB_TR + 52
18 libdispatch.dylib 0x00000001091f1828 _dispatch_call_block_and_release + 24
19 libdispatch.dylib 0x00000001091f2c04 _dispatch_client_callout + 16
20 libdispatch.dylib 0x00000001091f9b74 _dispatch_lane_serial_drain + 744
21 libdispatch.dylib 0x00000001091fa710 _dispatch_lane_invoke + 448
22 libdispatch.dylib 0x0000000109205ae4 _dispatch_workloop_worker_thread + 1324
23 libsystem_pthread.dylib 0x00000001a9ae3fa4 _pthread_wqthread + 276
24 libsystem_pthread.dylib 0x00000001a9ae6ae0 start_wqthread + 8!!! IMPORTANT: Please send this log and info about Realm SDK version and other relevant reproduction info to [email protected] 15:33:10.183786+0800 ESV[1050:442268] /Users/ramsey/Work/Codes/esv/Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp:433: [realm-core-5.23.5] Assertion failed: m_schema_version != ObjectStore::NotVersioned
0 Realm 0x0000000107be57dc _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 Realm 0x0000000107be5a3c _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 324
2 Realm 0x000000010791e25c _ZN5realm5Realm17set_schema_subsetENS_6SchemaE + 176
3 Realm 0x000000010785ab94 +[RLMRealm realmWithConfiguration:error:] + 1600
4 RealmSwift 0x0000000108dbe324 $sSo8RLMRealmC13configurationABSo0A13ConfigurationC_tKcfCTO + 148
5 RealmSwift 0x0000000108dbe4b0 $s10RealmSwift0A0C13configurationA2C13ConfigurationV_tKcfC + 200
6 ESV 0x0000000104b2773c $s3ESV11RealmHelperC5realm0B5Swift0B0CyF + 200
7 ESV 0x0000000104b27e78 $s3ESV11RealmHelperC10getObjects_12filterString0B5Swift7ResultsCyxGSgxm_SSSgtAF6ObjectCRbzlF + 292
8 ESV 0x0000000104ea60d0 $s3ESV7UtilityC8getTokenSSSgyF + 1636
9 ESV 0x0000000104934990 $s3ESV10NetworkAPIO5tokenSSSgvg + 104
10 ESV 0x00000001049344c0 $s3ESV10NetworkAPIO7headersSDyS2SGSgvg + 864
11 ESV 0x00000001049358d8 $s3ESV11RequestablePAASo8NSObjectCRbzrlE25setupNetworkComponentWith6netapi7mapType18mappedObjectHandle8moreInfo12isBackgroundyAA0E3APIO_qd__myqd__cSgyAA9CSMessageO_SbtcSgSbt0L6Mapper8MappableRd__lFySb_SS_SSttcfU_ + 1264
12 ESV 0x0000000104935f68 $s3ESV11RequestablePAASo8NSObjectCRbzrlE25setupNetworkComponentWith6netapi7mapType18mappedObjectHandle8moreInfo12isBackgroundyAA0E3APIO_qd__myqd__cSgyAA9CSMessageO_SbtcSgSbt0L6Mapper8MappableRd__lFySb_SS_SSttcfU_TA + 116
13 ESV 0x000000010493aef8 $s3ESV11RequestablePAASo8NSObjectCRbzrlE13isNeedRequest3for10completionyAA10NetworkAPIO_ySb_SS_SSttctFy5Cache6ResultOySSGcfU1_Tf2nni_n + 1620
14 ESV 0x000000010493afe0 $s5Cache6ResultOySSGIegg_ADIegn_TR + 64
15 Cache 0x000000010617a6d4 $s5Cache12AsyncStorageC6object6forKey10completionySS_yAA6ResultOyxGctFyAHyAA5EntryVyxGGcfU_ + 288
16 Cache 0x00000001061785dc $s5Cache12AsyncStorageC5entry6forKey10completionySS_yAA6ResultOyAA5EntryVyxGGctFyycfU_ + 1196
17 Cache 0x0000000106178710 $sIeg_IeyB_TR + 52
18 libdispatch.dylib 0x00000001091f1828 _dispatch_call_block_and_release + 24
19 libdispatch.dylib 0x00000001091f2c04 _dispatch_client_callout + 16
20 libdispatch.dylib 0x00000001091f9b74 _dispatch_lane_serial_drain + 744
21 libdispatch.dylib 0x00000001091fa710 _dispatch_lane_invoke + 448
22 libdispatch.dylib 0x0000000109205ae4 _dispatch_workloop_worker_thread + 1324
23 libsystem_pthread.dylib 0x00000001a9ae3fa4 _pthread_wqthread + 276
24 libsystem_pthread.dylib 0x00000001a9ae6ae0 start_wqthread + 8!!! IMPORTANT: Please send this log and info about Realm SDK version and other relevant reproduction info to [email protected].
@seamusapple
@bmunkholm
@seamusapple
- How often do you see this?
- Is this reproducible? How?
- Do you know anything about the circumstances when it occurs?
HI @bmunkholm ,
I got the same issue.
it keeps throws this issue in my Xcode. the Realm file is created but empty without any models.
And I don't know how to make it work again.
realm Version: 3.19.0
```
/Users/mac/code/3-bitmark/ourbeat/ios/Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp:433: [realm-core-5.23.5] Assertion failed: m_schema_version != ObjectStore::NotVersioned
0 Realm 0x000000011136c29c _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 Realm 0x000000011136c556 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 390
2 Realm 0x0000000111054e9d _ZN5realm5Realm17set_schema_subsetENS_6SchemaE + 189
3 Realm 0x0000000110f7e878 +[RLMRealm realmWithConfiguration:error:] + 2104
4 RealmSwift 0x00000001126afcd1 $sSo8RLMRealmC13configurationABSo0A13ConfigurationC_tKcfCTO + 145
5 RealmSwift 0x00000001126afe87 $s10RealmSwift0A0C13configurationA2C13ConfigurationV_tKcfC + 183
6 OurBeat Dev 0x000000010e73dca2 $s11OurBeat_Dev11RealmConfigO07currentD00D5Swift0D0CyKFZ + 850
7 OurBeat Dev 0x000000010e7386d1 $s11OurBeat_Dev7StorageC28performSerialBackgroundWrite33_0FFAEE7E3C7FDDC84B4052F48C9C9023LL10writeBlock010completionR0yy10RealmSwift0T0CKc_ys5Error_pSgcSgtFyycfU_ + 97
8 OurBeat Dev 0x000000010e72121d $sIeg_IeyB_TR + 45
9 libdispatch.dylib 0x0000000116093dd4 _dispatch_call_block_and_release + 12
10 libdispatch.dylib 0x0000000116094d48 _dispatch_client_callout + 8
11 libdispatch.dylib 0x000000011609b5ef _dispatch_lane_serial_drain + 788
12 libdispatch.dylib 0x000000011609c17f _dispatch_lane_invoke + 422
13 libdispatch.dylib 0x00000001160a7a4e _dispatch_workloop_worker_thread + 719
14 libsystem_pthread.dylib 0x0000000116510763 _pthread_wqthread + 290
15 libsystem_pthread.dylib 0x00000001165105c3 start_wqthread + 15!!! IMPORTANT: Please send this log and info about Realm SDK version and other relevant reproduction info to [email protected].
Hi @bmunkholm,
I can reproduce this issue very easily within my app:
Context
Steps
The issue happens when the user logs out, then logs back in during the same app session. When logout happens:
Next time the user logs in, I create the Realm with the following config (as every time before):
I see the following SIGABRT crash (Anonymised):
!!! IMPORTANT: Please send this log and info about Realm SDK version and other relevant reproduction info to [email protected]
APP_DERIVED_DATA/SourcePackages/checkouts/realm-cocoa/Realm/ObjectStore/src/shared_realm.cpp:433: [realm-core-5.23.8] Assertion failed: m_schema_version != ObjectStore::NotVersioned
0 AppName 0x0000000105f72228 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 32
1 AppName 0x0000000105f724b0 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 236
2 AppName 0x00000001059c752c _ZN5realm5Realm17set_schema_subsetENS_6SchemaE + 176
3 AppName 0x0000000105afeb60 +[RLMRealm realmWithConfiguration:error:] + 1600
4 AppName 0x0000000105b549ec $sSo8RLMRealmC13configurationABSo0A13ConfigurationC_tKcfCTO + 148
5 AppName 0x0000000105b54b04 $s10RealmSwift0A0C13configurationA2C13ConfigurationV_tKcfC + 84
I tried to debug and understand how Realm creation works, what I can see:
When I call resetRealmState on RLMRealm the issue is not occurring, because both RLMRealm cache and the coordinator cache is cleared. Unfortunately this is only ok for me for a single user. When a second user is logged in, I would not clear the cache as I assume, everything stored as a weak pointer and that would render my application unresponsive for data changes.
To summarise this, I think this could be a Realm Caching issue.
Any help is much appreciated :)
@WiesnerPeti Thanks a lot for the analysis! It would be super useful if you could possibly reproduce this in a minimal test-app that you could share?
Calling invalidate does not actually close the Realm, so after deleting the Realm file and reopening it you have two different files open at the same path. We (incorrectly) assume that file paths uniquely identify files, and then hit an assertion failure in the first place where that assumption being violated matters. resetRealmState works around this by closing all open Realms, which obviously isn't a good answer if you want to be keeping other Realms open.
This specific assertion failure is probably pretty easy to fix, but you'd probably still run into more problems elsewhere.
What is your suggestion @tgoyne ?
I know that invalidate won't close Realm, it just invalidates the objects (tokens, lists) managed by Realm (per documentation). As I learned Realm in other languages (like JAVA), Realm has a close method, but on iOS, it depends on releasing the strong references to the Realm.
An API similar to resetRealmState just for a single realm, would be great, I think.
@bmunkholm I was able to create a test project. You can download it here.
Steps:
_Good news_: I it will show the assertion failure. _Bad news_: It does not 100% similar to the issue I have. In my original case, I use the new deleteFiles API, that won't delete actually the Realm files as the connection is open, yet my issue occurs. In this example project, I delete the Realm by hand, so @tgoyne 's scenario happens.
Hi @tgoyne , @bmunkholm ,
what is the resolution here? Are you looking to improve on this or I should make sure all Realm strong reference is released?
Thank you for the answer in advance! :)
Hi @tgoyne , @bmunkholm
we are seeing increased crash rates due to this bug, can you please share an update on this issue? Did the sample project help?
@WiesnerPeti Really sorry about the lacking response here! I know tgoyne wanted to write up something for you, but he has been rather backlogged for a while. The gist of it is that until we can make this easier for you, you will have to ensure that you don't use a realm that isn't properly closed. tgoyne may be able to give you more hints on how to do that when he frees up.
@bmunkholm Thank you for the response :) Any additional hint is welcomed :)
I ended up revisiting our memory and thread management regarding Realm and I fixed the issue :) In our application, we not only disposed Realm, but also the threads the user's realm was used on. We recreated the threads with the same name once the user logged in. Maybe the thread with the same name, but different memory address (id) could mess with the internal Realm Cache?
Thank you very much for your help and advice!
Sounds like you got it fixed now then? But you also mention any hints are welcomed? So not sure if you still need help or we can close this issue?
Sorry for the misunderstanding: