Skip to content

Crash on app startup in realm core code due to non-strict ordering comparator #8028

@jadar

Description

@jadar

SDK and version

SDK : Cocoa/Swift (Cocoa, Java, etc)
Version: v10.53.1

Observations

  • How frequent do the crash occur?
    • Every time
  • Does it happen in production or during dev/test?
    • Dev/Test
  • Can the crash be reproduced by you?
    • Yes
  • Can you provide instructions for how we can reproduce it?
    • Start app with our schema

Crash log / stacktrace

Realm notification listener (13)#0	0x000000018016c588 in __abort ()
#1	0x000000018016c4f8 in abort ()
#2	0x000000010c461598 in std::__1::__check_strict_weak_ordering_sorted[abi:de180100]<std::__1::unique_ptr<realm::ParentNode, std::__1::default_delete<realm::ParentNode>>*, realm::OrNode::combine_conditions(bool)::'lambda'(auto&, auto&)> at /Applications/Xcode-16.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk/usr/include/c++/v1/__debug_utils/strict_weak_ordering_check.h:58
#3	0x000000010c461260 in std::__1::__sort_impl[abi:de180100]<std::__1::_ClassicAlgPolicy, std::__1::__wrap_iter<std::__1::unique_ptr<realm::ParentNode, std::__1::default_delete<realm::ParentNode>>*>, realm::OrNode::combine_conditions(bool)::'lambda'(auto&, auto&)> at /Applications/Xcode-16.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk/usr/include/c++/v1/__algorithm/sort.h:998
#4	0x000000010c460d90 in std::__1::sort[abi:de180100]<std::__1::__wrap_iter<std::__1::unique_ptr<realm::ParentNode, std::__1::default_delete<realm::ParentNode>>*>, realm::OrNode::combine_conditions(bool)::'lambda'(auto&, auto&)> at /Applications/Xcode-16.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk/usr/include/c++/v1/__algorithm/sort.h:1004
#5	0x000000010c4606e4 in realm::OrNode::combine_conditions at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/query_engine.hpp:2286
#6	0x000000010c45f74c in realm::OrNode::init at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/query_engine.hpp:2180
#7	0x000000010c3b9c64 in realm::Query::init at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/query.cpp:1883
#8	0x000000010c3ba038 in realm::Query::do_find_all at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/query.cpp:1413
#9	0x000000010c734564 in realm::TableView::do_sync at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/table_view.cpp:482
#10	0x000000010c734fd8 in realm::TableView::apply_descriptor_ordering at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/table_view.cpp:404
#11	0x000000010c20dd28 in realm::_impl::ResultsNotifier::run at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/object-store/impl/results_notifier.cpp:194
#12	0x000000010c1f00f8 in realm::_impl::RealmCoordinator::run_async_notifiers at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/object-store/impl/realm_coordinator.cpp:1030
#13	0x000000010c1ef600 in realm::_impl::RealmCoordinator::on_change at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/object-store/impl/realm_coordinator.cpp:894
#14	0x000000010c1861f4 in realm::_impl::ExternalCommitHelper::listen at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/object-store/impl/apple/external_commit_helper.cpp:234
#15	0x000000010c18695c in realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&, realm::RealmConfig const&)::$_0::operator()() const at /Users/jacob/Library/Developer/Xcode/DerivedData/TractionField-czfssazbudivavdunakatdqiiajo/SourcePackages/checkouts/realm-core/src/realm/object-store/impl/apple/external_commit_helper.cpp:175
#16	0x000000010c18690c in std::__1::__invoke[abi:de180100]<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&, realm::RealmConfig const&)::$_0> at /Applications/Xcode-16.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk/usr/include/c++/v1/__type_traits/invoke.h:344
#17	0x000000010c1868e8 in std::__1::__thread_execute[abi:de180100]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&, realm::RealmConfig const&)::$_0> at /Applications/Xcode-16.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk/usr/include/c++/v1/__thread/thread.h:199
#18	0x000000010c1865f8 in std::__1::__thread_proxy[abi:de180100]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&, realm::RealmConfig const&)::$_0>> at /Applications/Xcode-16.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk/usr/include/c++/v1/__thread/thread.h:208
#19	0x0000000104bfb414 in _pthread_start ()

Steps & Code to Reproduce

I'm not sure what exactly is causing this, since the code crashes in Realm's internals. The context of the crashed code seems to be in sorting columns, which indicates to me it's a problem with something in our schema that is outside of the norm (unsure what that would be, we only just bumped the version to the latest non-v20 release.) It looks like the codepath goes through some code that was recently changed (thus would be the source of the different behavior, since the last time we updated was in April.) Suspected commit is eef7fcf#diff-251da97dc2f3dad702887aa32c15789820ee0c88eb5fc9db7be4b91e65e5f45aR2231

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions