Realm-cocoa: 5.3.0 - App crash in migrate_indexes()

Created on 29 Jul 2020  路  16Comments  路  Source: realm/realm-cocoa

Goals


Seems after migration from the Realm version 4.4.0 to 5.3.0 some users of the app started caught crash at launching the app.

  • I need your help to figure out how this crash can be fixed.
  • Can I rollback to the previous version 4.4.0 without any problems for user which successfully migrated to the Realm version 5.3.0?

Expected Results


I expect to get migration from version 4.4.0 to the latest version without crash.

Actual Results


Screenshot 2020-07-29 at 22 55 36

Thread 0#0  (null) in __pthread_kill ()
#1  (null) in pthread_kill ()
#2  (null) in abort ()
#3  (null) in please_report_this_error_to_help_at_realm_dot_io ()
#4  (null) in realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) ()
#5  (null) in realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&) ()
#6  0x0000000106597684 in void realm::util::terminate<unsigned long long, unsigned long long>(char const*, char const*, long, unsigned long long, unsigned long long) ()
#7  (null) in realm::Array::move(unsigned long, unsigned long, unsigned long) ()
#8  (null) in realm::Table::migrate_indexes(realm::ColKey, realm::util::FunctionRef<void ()>) ()
#9  (null) in realm::Transaction::upgrade_file_format(int) ()
#10 (null) in realm::DB::upgrade_file_format(bool, int, int, int) ()
#11 (null) in realm::DB::do_open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, bool, realm::DBOptions) ()
#12 (null) in realm::DB::open(realm::Replication&, realm::DBOptions) ()
#13 (null) in realm::DB::create(realm::Replication&, realm::DBOptions) ()
#14 (null) in realm::_impl::RealmCoordinator::open_db() ()
#15 (null) in realm::_impl::RealmCoordinator::do_get_realm(realm::Realm::Config, std::__1::shared_ptr<realm::Realm>&, realm::util::Optional<realm::VersionID>, realm::util::CheckedUniqueLock&) ()
#16 (null) in realm::_impl::RealmCoordinator::get_realm(realm::Realm::Config, realm::util::Optional<realm::VersionID>) ()
#17 0x000000010668ac54 in realm::Realm::get_shared_realm(realm::Realm::Config) at /Users/ivanov/Main/Projects/Projects - FaceIT/Steps/Steps/steps source 2/Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp:144
#18 0x000000010665a278 in +[RLMRealm realmWithConfiguration:queue:error:] at /Users/ivanov/Main/Projects/Projects - FaceIT/Steps/Steps/steps source 2/Pods/Realm/Realm/RLMRealm.mm:504
#19 (null) in Realm.init(queue:) ()
#20 (null) in specialized static Database.me(realm:) ()
#21 (null) in specialized AppDelegate.configureMixpanel() ()
#22 (null) in AppDelegate.application(_:didFinishLaunchingWithOptions:) ()
#23 (null) in @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) ()
#24 (null) in -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] ()
#25 (null) in -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] ()
#26 (null) in -[UIApplication _runWithMainScene:transitionContext:completion:] ()
#27 (null) in -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] ()
#28 (null) in _UIScenePerformActionsWithLifecycleActionMask ()
#29 (null) in __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke ()
#30 (null) in -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] ()
#31 (null) in -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] ()
#32 (null) in -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] ()
#33 (null) in __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block... ()
#34 (null) in +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] ()
#35 (null) in _UISceneSettingsDiffActionPerformChangesWithTransitionContext ()
#36 (null) in __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block... ()
#37 (null) in _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext ()
#38 (null) in -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] ()
#39 (null) in __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke ()
#40 (null) in -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] ()
#41 (null) in -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] ()
#42 (null) in -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] ()
#43 (null) in -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] ()
#44 (null) in -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] ()
#45 (null) in __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.168 ()
#46 (null) in -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] ()
#47 (null) in __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke ()
#48 (null) in _dispatch_client_callout ()
#49 (null) in _dispatch_block_invoke_direct ()
#50 (null) in __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ ()
#51 (null) in -[FBSSerialQueue _queue_performNextIfPossible] ()
#52 (null) in -[FBSSerialQueue _performNextFromRunLoopSource] ()
#53 (null) in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#54 (null) in __CFRunLoopDoSource0 ()
#55 (null) in __CFRunLoopDoSources0 ()
#56 (null) in __CFRunLoopRun ()
#57 (null) in CFRunLoopRunSpecific ()
#58 (null) in GSEventRunModal ()
#59 (null) in UIApplicationMain ()
#60 0x00000001045f0ea8 in main at /Users/ivanov/Main/Projects/Projects - FaceIT/Steps/Steps/steps source 2/Steps/Sources/ViewControllers/Main/Step/Step Creation/Main Controller/STCreateStepMainViewController.swift:38
#61 (null) in start ()

Steps for others to Reproduce


I can't to reproduce this crash.

Code Sample


I am not sure what the part of code I should provide. If you know, ask me.

Version of Realm and Tooling


Realm framework version: ?
Was 4.4.0 became 5.3.0

ProductName: Mac OS X
ProductVersion: 10.15.4
BuildVersion: 19E266

/Applications/Xcode.app/Contents/Developer
Xcode 11.5
Build version 11E608c

/Users/ivanov/.rbenv/shims/pod
1.9.3
Realm (5.3.0)
RealmSwift (5.3.0)

O-Community

All 16 comments

This may be fixed in 5.3.2; there was a fix for a bug which resulted in an assertion failure in Table::migrate_indexes().

Any files which were successfully upgraded can't be opened by 4.4.0, but the source file is left unchanged when it crashes during the upgrade.

Thank you for quick answer. I will try the latest version.

@tgoyne I'have reproduced this bug for Realm version 5.3.0, but after update Realm to the version 5.3.2 I get the new one crash

/Users/realm/workspace/realm_realm-core_release_6.0.12/src/realm/array_string.cpp:57: [realm-core-6.0.12] Assertion failed: m_spec != nullptr
0   Realm                               0x0000000107918570 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1   Realm                               0x0000000107918814 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 328
2   Realm                               0x000000010782ef7c _ZN5realm11ArrayString13init_from_memENS_6MemRefE + 788
3   Realm                               0x000000010787e3d4 _ZN5realm9BPlusTreeINS_10StringDataEE14init_leaf_nodeEm + 212
4   Realm                               0x0000000107837518 _ZN5realm13BPlusTreeBase20create_root_from_refEm + 240
5   Realm                               0x0000000107356cd0 _ZN5realm13BPlusTreeBase16init_from_parentEv + 88
6   Realm                               0x00000001078d9dac _ZN5realm5Table15migrate_objectsENS_6ColKeyENS_4util11FunctionRefIFvvEEE + 2812
7   Realm                               0x000000010784acc0 _ZN5realm11Transaction19upgrade_file_formatEi + 1656
8   Realm                               0x00000001078549cc _ZN5realm2DB19upgrade_file_formatEbiii + 292
9   Realm                               0x0000000107852678 _ZN5realm2DB7do_openERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbbNS_9DBOptionsE + 3516
10  Realm                               0x0000000107854fec _ZN5realm2DB4openERNS_11ReplicationENS_9DBOptionsE + 244
11  Realm                               0x00000001078597a8 _ZN5realm2DB6createERNS_11ReplicationENS_9DBOptionsE + 392
12  Realm                               0x000000010740a210 _ZN5realm5_impl16RealmCoordinator7open_dbEv + 972
13  Realm                               0x0000000107409464 _ZN5realm5_impl16RealmCoordinator12do_get_realmENS_5Realm6ConfigERNSt3__110shared_ptrIS2_EENS_4util8OptionalINS_9VersionIDEEERNS8_17CheckedUniqueLockE + 72
14  Realm                               0x00000001074092fc _ZN5realm5_impl16RealmCoordinator9get_realmENS_5Realm6ConfigENS_4util8OptionalINS_9VersionIDEEE + 268
15  Realm                               0x000000010765be68 _ZN5realm5Realm16get_shared_realmENS0_6ConfigE + 152
16  Realm                               0x00000001075a66b4 +[RLMRealm realmWithConfiguration:queue:error:] + 1760
17  RealmSwift                          0x00000001089a32cc $sSo8RLMRealmC13configuration5queueABSo0A13ConfigurationC_So012OS_dispatch_C0CSgtKcfCTO + 156
18  RealmSwift                          0x00000001089daa80 $s10RealmSwift0A0V5queueACSo012OS_dispatch_C0CSg_tKcfC + 140
19  STEPS                               0x000000010133dd8c $s5STEPS8DatabaseC5realm10RealmSwift0D0VSgvgZ + 64
20  STEPS                               0x0000000101ebf15c $s5STEPS8DatabaseC2me5realmAA4UserCSg10RealmSwift0F0VSg_tFZ + 180
21  STEPS                               0x000000010131b770 $s5STEPS11AppDelegateC17configureMixpanelyyF + 756
22  STEPS                               0x0000000100eab1f4 $s5STEPS11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 1240
23  STEPS                               0x0000000100eac9ac $s5STEPS11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFTo + 232
24  UIKitCore                           0x00000001c118878c 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 10893196
25  UIKitCore                           0x00000001c118a56c 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 10900844
26  UIKitCore                           0x00000001c118ff68 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 10923880
27  UIKitCore                           0x00000001c0902b50 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1956688
28  UIKitCore                           0x00000001c0dcd510 _UIScenePerformActionsWithLifecycleActionMask + 112
29  UIKitCore                           0x00000001c0903684 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1959556
30  UIKitCore                           0x00000001c09030b0 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1958064
31  UIKitCore                           0x00000001c09034a0 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1959072
32  UIKitCore                           0x00000001c0902d28 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1957160
33  UIKitCore                           0x00000001c0907444 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1975364
34  UIKitCore                           0x00000001c0cec080 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 6058112
35  UIKitCore                           0x00000001c0de71b4 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 260
36  UIKitCore                           0x00000001c0907180 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1974656
37  UIKitCore                           0x00000001c0de709c _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 108
38  UIKitCore                           0x00000001c0906fd8 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1974232
39  UIKitCore                           0x00000001c076cdb8 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 294328
40  UIKitCore                           0x00000001c076b8b8 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 288952
41  UIKitCore                           0x00000001c076cae8 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 293608
42  UIKitCore                           0x00000001c118e200 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 10916352
43  UIKitCore                           0x00000001c0d12a50 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 6216272
44  FrontBoardServices                  0x00000001c22a8bec 039FCB83-A7EC-3872-94E8-DD490434EAEB + 52204
45  FrontBoardServices                  0x00000001c22cf190 039FCB83-A7EC-3872-94E8-DD490434EAEB + 209296
46  FrontBoardServices                  0x00000001c22b3aac 039FCB83-A7EC-3872-94E8-DD490434EAEB + 96940
47  FrontBoardServices                  0x00000001c22cee24 039FCB83-A7EC-3872-94E8-DD490434EAEB + 208420
48  libdispatch.dylib                   0x000000010991b18c _dispatch_client_callout + 20
49  libdispatch.dylib                   0x000000010991e964 _dispatch_block_invoke_direct + 368
50  FrontBoardServices                  0x00000001c22f52b4 039FCB83-A7EC-3872-94E8-DD490434EAEB + 365236
51  FrontBoardServices                  0x00000001c22f4f60 039FCB83-A7EC-3872-94E8-DD490434EAEB + 364384
52  FrontBoardServices                  0x00000001c22f54cc 039FCB83-A7EC-3872-94E8-DD490434EAEB + 365772
53  CoreFoundation                      0x00000001bcfc3860 9624AAFD-5437-3772-A507-0F357875808D + 710752
54  CoreFoundation                      0x00000001bcfc37b4 9624AAFD-5437-3772-A507-0F357875808D + 710580
55  CoreFoundation                      0x00000001bcfc2f04 9624AAFD-5437-3772-A507-0F357875808D + 708356
56  CoreFoundation                      0x00000001bcfbdca4 9624AAFD-5437-3772-A507-0F357875808D + 687268
57  CoreFoundation                      0x00000001bcfbd660 CFRunLoopRunSpecific + 480
58  GraphicsServices                    0x00000001c73ce604 GSEventRunModal + 164
59  UIKitCore                           0x00000001c119215c UIApplicationMain + 1944
60  STEPS                               0x0000000100eafbc8 main + 80
61  libdyld.dylib                       0x00000001bce391ec 95B366E7-F5BD-3308-9416-24B35999029B + 4588!!! IMPORTANT: Please send this log and info about Realm SDK version and other relevant reproduction info to [email protected].(lldb) 

Same error for version 5.3.3

@IvanovDeveloper @aviadsteps
Could either of you provide:

  • a realm file from 4.4.0 that hits the originally reported exception when upgrading from 4.4.0 to >=5.3.2
  • a realm file that was 1) upgraded from 4.4.0 to 5.3.0, 2) hits the reported exception, 3) then upgraded from 5.3.0 to >=5.3.2
  • a code snippet of how these realm files are opened. Or a reproduction project in a .zip file. This would help immensely.

I'm asking because some of the changes added from 5.3.0 to 5.3.2 may make it so a realm file upgraded from 4.4.x -> 5.3.0 -> >=5.3.2 behaves differently from a file upgraded from 4.4.x -> 5.3.3.

If you can't share the above in a public github issue, let me know and I can organize a secure channel for you.

@ericjordanmossman

a code snippet of how these realm files are opened. Or a reproduction project in a .zip file. This would help immensely.

I can provide the code of Realm usage and configuration

https://gist.github.com/IvanovDeveloper/c0471490c60ffe029156381acefc8032

a realm file from 4.4.0 that hits the originally reported exception when upgrading from 4.4.0 to >=5.3.2
a realm file that was 1) upgraded from 4.4.0 to 5.3.0, 2) hits the reported exception, 3) then upgraded from 5.3.0 to >=5.3.2

I will try to get this data and let you know a little bit later about result

If you can't share the above in a public github issue, let me know and I can organize a secure channel for you.

@ericjordanmossman Please create a secure channel for providing realm data

@IvanovDeveloper Could you email me at eric.[email protected]. I'll send you a link to our support team's secure uploader.

@ericjordanmossman check your mail please

@ericjordanmossman Hello, I sent you an email in order to get a link to the support team's secure uploader. I have the files for the investigation.

@IvanovDeveloper @ericjordanmossman
i face the same issue in 5.3.3 and 5.3.4
how can i fix it.

Crashed: com.apple.main-thread
0  libsystem_kernel.dylib         0x19603b0dc __pthread_kill + 8
1  libsystem_pthread.dylib        0x1960b4094 pthread_kill$VARIANT$mp + 380
2  libsystem_c.dylib              0x195f93ea8 abort + 140
3  Realm                          0x1021cd910 realm::util::terminate(char const*, char const*, long) + 10
4  Realm                          0x1021cdc1c realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 780
5  Realm                          0x1021cdd94 realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&) + 328
6  Realm                          0x10215dd74 realm::Obj::remove_backlink(realm::ColKey, realm::ObjKey, realm::CascadeState&) + 404
7  Realm                          0x10215c618 realm::Obj& realm::Obj::set<realm::ObjKey>(realm::ColKey, realm::ObjKey, bool) + 464
8  Realm                          0x10219401c realm::Table::migrate_links(realm::util::FunctionRef<void ()>) + 1512
9  Realm                          0x1020e9640 realm::Transaction::upgrade_file_format(int) + 1716
10 Realm                          0x1020f369c realm::DB::upgrade_file_format(bool, int, int, int) + 288
11 Realm                          0x1020f1424 realm::DB::do_open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, bool, realm::DBOptions) + 3520
12 Realm                          0x1020f3cbc realm::DB::open(realm::Replication&, realm::DBOptions) + 244
13 Realm                          0x1020f83cc realm::DB::create(realm::Replication&, realm::DBOptions) + 392
14 Realm                          0x101ed00a0 realm::_impl::RealmCoordinator::open_db() + 1156
15 Realm                          0x101ecf214 realm::_impl::RealmCoordinator::do_get_realm(realm::Realm::Config, std::__1::shared_ptr<realm::Realm>&, realm::util::Optional<realm::VersionID>, realm::util::CheckedUniqueLock&) + 68
16 Realm                          0x101ecf0a8 realm::_impl::RealmCoordinator::get_realm(realm::Realm::Config, realm::util::Optional<realm::VersionID>) + 168
17 Realm                          0x101fa5468 realm::Realm::get_shared_realm(realm::Realm::Config) + 187 (shared_realm.hpp:187)
18 Realm                          0x101f74a8c +[RLMRealm realmWithConfiguration:queue:error:] + 4216 (memory:4216)
19 RealmSwift                     0x102474610 Realm.init(queue:) + 4338370064 (<compiler-generated>:4338370064)

^ @jedelbo @finnschiermer
Would migrate_links be susceptible to the same issues as migrate_indexes?

@ericjordanmossman
I'm sorry and i comment again in #6680
thank you for your attention

@ericjordanmossman The migrate_links issue is caused by something else than the migrate_indexes issue.

We believe that we have fixed the issues present in v5.3.0. As no new information is available, this issue is closed. If the problem can be observed using v5.3.5 or later, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xspyhack picture xspyhack  路  3Comments

dmorrow picture dmorrow  路  3Comments

matteodanelli picture matteodanelli  路  3Comments

jpsim picture jpsim  路  3Comments

carvalho-oak picture carvalho-oak  路  3Comments