realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.31k stars 2.15k forks source link

crash on realm migration #5727

Closed brianll closed 3 years ago

brianll commented 6 years ago

Goals

I realm migration on startup

Expected Results

I migration is performed

Actual Results

Crashed: com.locationlabs.location-store 0 libsystem_kernel.dylib 0x182b902e8 pthread_kill + 8 1 libsystem_pthread.dylib 0x182ca52f8 pthread_kill$VARIANT$mp + 396 2 libsystem_c.dylib 0x182afefbc abort + 140 3 Realm 0x10581e4f8 please_report_this_error_to_help_at_realm_dot_io + 10 4 Realm 0x10581e9e0 realm::util::terminate_internal(std::1::basic_stringstream<char, std::1::char_traits, std::1::allocator >&) + 356 5 libsystem_pthread.dylib 0x182ca52f8 pthreadkill$VARIANT$mp + 396 6 Realm 0x10581eb80 realm::util::terminate(char const, char const_, long, std::initializer_list&&) + 388 7 libsystem_pthread.dylib 0x182ca52f8 pthreadkill$VARIANT$mp + 396 8 Realm 0x105823238 void realm::util::terminate<unsigned char, int>(char const, char const_, long, unsigned char, int) + 50 9 Realm 0x105822924 realm::SlabAlloc::attach_file(std::1::basic_string<char, std::1::char_traits, std::1::allocator > const&, realm::SlabAlloc::Config&) + 3596 10 Realm 0x1058d3dc8 realm::SharedGroup::do_open(std::1::basic_string<char, std::1::char_traits, std::1::allocator > const&, bool, bool, realm::SharedGroupOptions) + 1612 11 Realm 0x1057876a0 realm::SharedGroup::open(realm::Replication&, realm::SharedGroupOptions) + 172 12 Realm 0x105787358 realm::SharedGroup::SharedGroup(realm::Replication&, realm::SharedGroupOptions) + 720 13 Realm 0x105781f50 realm::Realm::open_with_config(realm::Realm::Config const&, std::1::unique_ptr<realm::Replication, std::1::default_delete >&, std::1::unique_ptr<realm::SharedGroup, std::1::default_delete >&, std::1::unique_ptr<realm::Group, std::1::default_delete >&, realm::Realm*) + 740 14 Realm 0x105781aa0 realm::Realm::Realm(realm::Realm::Config, std::1::shared_ptr) + 196 15 Realm 0x1056c6688 realm::Realm::make_shared_realm(realm::Realm::Config, std::1::shared_ptr)::make_shared_enabler::make_shared_enabler(realm::Realm::Config, std::1::shared_ptr) + 88 16 Realm 0x1056c64fc std::1::shared_ptr<realm::Realm::make_shared_realm(realm::Realm::Config, std::1::shared_ptr)::make_shared_enabler> std::1::shared_ptr<realm::Realm::make_shared_realm(realm::Realm::Config, std::__1::shared_ptr)::make_shared_enabler>::make_shared<realm::Realm::Config, std::1::shared_ptr >(realm::Realm::Config&&, std::1::shared_ptr&&) + 136 17 Realm 0x1056c2730 realm::_impl::RealmCoordinator::get_realm(realm::Realm::Config) + 524 18 Realm 0x10578383c realm::Realm::get_shared_realm(realm::Realm::Config) + 108 19 Realm 0x10575e7f0 ﹍[RLMRealm realmWithConfiguration:error:]﹍ 612 20 Realm 0x105760b44 ﹍[RLMRealm performMigrationForConfiguration:error:]﹍ 116 21 RealmSwift 0x105cfff0c _T010RealmSwift0A0C16performMigrationyAC13ConfigurationV3for_tKFZ + 400 22 LocoPersist 0x103cdcee4 _T011LocoPersist35compactPersistanceWithConfigurationyAA0F0C_Sb17deleteIfCorruptedtFyycfU_yycfU_Tf4gn_n + 412 23 LocoPersist 0x103ceae24 _T011LocoPersist35compactPersistanceWithConfigurationyAA0F0C_Sb17deleteIfCorruptedtFyycfU_yycfU_TA + 52 24 LocoPersist 0x103ce4cbc _T0s5Error_pIxzo_ytsAA_pIxrzo_TRTA + 52 25 LocoPersist 0x103ceb0f4 _T0s5Error_pIxzo_ytsAA_pIxrzo_TRTA.597 + 12 26 libswiftObjectiveC.dylib 0x1067a8e1c autoreleasepool(invoking:) + 4447751708 27 LocoPersist 0x103cd2eb0 _T011LocoPersist35compactPersistanceWithConfigurationyAA0F0C_Sb17deleteIfCorruptedtFyycfU_TA + 160 28 LocoPersist 0x103cc61e8 _T0Ix_IyB_TR + 36 29 libdispatch.dylib 0x1829faa54 _dispatch_call_block_and_release + 24 30 libdispatch.dylib 0x1829faa14 _dispatch_client_callout + 16 31 libdispatch.dylib 0x182a0496c _dispatch_queue_serial_drain$VARIANT$mp + 528 32 libdispatch.dylib 0x182a052fc _dispatch_queue_invoke$VARIANT$mp + 340 33 libdispatch.dylib 0x182a05d20 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 404 34 libdispatch.dylib 0x182a0e03c _dispatch_workloop_worker_thread$VARIANT$mp + 644 35 libsystem_pthread.dylib 0x182ca2f1c _pthread_wqthread + 932 36 libsystem_pthread.dylib 0x182ca2b6c start_wqthread + 4

Steps to Reproduce

This has happened to one user, after the device ran out of battery, and was then charged again. Upon starting the app in this condition, it was crashing repeatedly with the above stack trace.

Code Sample

Version of Realm and Tooling

RealmSwift 2.10.1 iOS 11.2.6 Swinject 2.0.0 Cocoapods 1.2

bmunkholm commented 6 years ago

Sounds like the file may have been corrupted by that process. Can't really do that much about it without a repro-case. Thanks for reporting though!