Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS some devices app startup always crash, unless Remove and reinstall app #8410

Closed
xiaoquan7791 opened this issue Nov 1, 2023 · 9 comments
Assignees
Labels
Encryption:Off Frequency:Always More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community Repro:Always SDK-Use:Local T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed

Comments

@xiaoquan7791
Copy link

How frequently does the bug occur?

Always

Description

when realm sdk version was v2.8.2 have the problem , and we update realm sdk version to 10.32.3 have problem too.

Stacktrace & log output

when realm sdk v2.8.2, the rash stacktrace:
libsystem_kernel.dylib
__pthread_kill + 8
1
libsystem_pthread.dylib
pthread_kill + 212
2
libsystem_c.dylib
_abort + 120
std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(long)
realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 356
realm::util::terminate_with_info(char const*, char const*, long, char const*, std::initializer_list<realm::util::Printable>&&) + 452
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, realm::util::CaseInsensitiveCompare, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::__find_equal_key(std::__1::__tree_node_base<void*>*&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
realm::Group::attach(unsigned long, bool) + 180
realm::SharedGroup::do_begin_read(realm::VersionID, bool) + 76
realm::SharedGroup::begin_read(realm::VersionID) + 36
realm::Realm::begin_read(realm::VersionID) (shared_realm.cpp:214)
realm::Realm::read_group() (shared_realm.cpp:203)
realm::Realm::Realm(realm::Realm::Config, std::__1::shared_ptr<realm::_impl::RealmCoordinator>) (memory:2863)
realm::Realm::make_shared_realm(realm::Realm::Config, std::__1::shared_ptr<realm::_impl::RealmCoordinator>)::make_shared_enabler::make_shared_enabler(realm::Realm::Config, std::__1::shared_ptr<realm::_impl::RealmCoordinator>) (memory:3237)
realm::Realm::make_shared_realm(realm::Realm::Config, std::__1::shared_ptr<realm::_impl::RealmCoordinator>) (memory:3237)
realm::_impl::RealmCoordinator::get_realm(realm::Realm::Config) (memory:3148)
realm::Realm::get_shared_realm(realm::Realm::Config) (memory:3237)
+[RLMRealm realmWithConfiguration:error:] (memory:3148)
+[RLMRealm defaultRealm] (RLMRealm.mm:0)

when realm sdk version update to 10.32.3:

libsystem_kernel.dylib
___pthread_kill + 8
libsystem_pthread.dylib
_pthread_kill + 268
libsystem_c.dylib
_abort + 180
realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&)
realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 260
realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&) + 328
realm::StringIndex::do_delete(realm::ObjKey, realm::StringData, unsigned long) + 1936
realm::StringIndex::do_delete(realm::ObjKey, realm::StringData, unsigned long) + 1504
realm::StringIndex::do_delete(realm::ObjKey, realm::StringData, unsigned long) + 1504
realm::StringIndex::erase(realm::ObjKey) + 156
realm::Table::erase_from_search_indexes(realm::ObjKey) + 76
realm::ClusterTree::erase(realm::ObjKey, realm::CascadeState&) + 44
realm::Table::batch_erase_rows(realm::BPlusTree<realm::ObjKey> const&) + 1136
realm::TableView::clear() + 144
realm::Results::clear() + 216
-[RLMResults deleteObjectsFromRealm] (RLMResults.mm:506)
-[RLMRealm deleteObjects:] (RLMRealm.mm:101

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

10.32.3

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS 16.6 (20G75) 15.6 and more

Build environment

Xcode version: ...
Dependency manager and version: ...

@xiaoquan7791
Copy link
Author

xiaoquan7791 commented Nov 1, 2023

realm sdk version 10.32.3 some crash stacktrace like:

#0 Thread
SIGABRT
libsystem_kernel.dylib
___pthread_kill + 8
libsystem_pthread.dylib
_pthread_kill + 268
libsystem_c.dylib
_abort + 180
realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&)
realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 260
realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&) + 328
terminate_with_info<const char &, unsigned long &> (terminate.hpp:51)
realm::ArrayBlob::replace(unsigned long, unsigned long, char const*, unsigned long, bool) + 552
realm::ArraySmallBlobs::insert(unsigned long, realm::BinaryData, bool) + 140
void realm::Cluster::do_insert_row<realm::ArrayString>(unsigned long, realm::ColKey, realm::Mixed, bool) + 152
realm::util::FunctionRef<realm::IteratorControl (realm::ColKey)>::FunctionRef<realm::Cluster::insert_row(unsigned long, realm::ObjKey, realm::FieldValues const&)::$_1&>(realm::Cluster::insert_row(unsigned long, realm::ObjKey, realm::FieldValues const&)::$_1&)::{lambda(void*, realm::ColKey)#1}::__invoke(void*, realm::ColKey) + 456
realm::TableClusterTree::for_each_and_every_column(realm::util::FunctionRef<realm::IteratorControl (realm::ColKey)>) const + 84
realm::Cluster::insert_row(unsigned long, realm::ObjKey, realm::FieldValues const&) + 208
realm::Cluster::insert(realm::ObjKey, realm::FieldValues const&, realm::ClusterNode::State&) + 240
realm::ClusterNodeInner::insert(realm::ObjKey, realm::FieldValues const&, realm::ClusterNode::State&)::$_1::operator()(realm::ClusterNode*, realm::ClusterNodeInner::ChildInfo&) const + 72
realm::ClusterNodeInner::insert(realm::ObjKey, realm::FieldValues const&, realm::ClusterNode::State&) + 232
realm::ClusterTree::insert_fast(realm::ObjKey, realm::FieldValues const&, realm::ClusterNode::State&) + 48
realm::ClusterTree::insert(realm::ObjKey, realm::FieldValues const&) + 48
realm::TableClusterTree::insert(realm::ObjKey, realm::FieldValues const&) + 52
realm::Table::create_object_with_primary_key(realm::Mixed const&, realm::FieldValues&&, realm::Table::UpdateMode, bool*) + 860
realm::Table::create_object_with_primary_key(realm::Mixed const&, bool*) (vector:485)
realm::Object realm::Object::create<objc_object* __strong, RLMAccessorContext>(RLMAccessorContext&, std::__1::shared_ptr<realm::Realm> const&, realm::ObjectSchema const&, objc_object* __strong, realm::CreatePolicy, realm::ObjKey, realm::Obj*) (object_accessor.hpp:306)
RLMAccessorContext::createObject(objc_object*, realm::CreatePolicy, bool, realm::ObjKey) (RLMAccessor.mm:1102)
RLMAddObjectToRealm (RLMObjectStore.mm:120)
-[RLMRealm addOrUpdateObject:] (RLMRealm.mm:990)

any idea to this problem?

@xiaoquan7791
Copy link
Author

xiaoquan7791 commented Nov 1, 2023

realm sdk v10.32.3 some crash stacktrace like:

libsystem_kernel.dylib
___pthread_kill + 8
libsystem_pthread.dylib
_pthread_kill + 268
libsystem_c.dylib
_abort + 180
realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&)
realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 260
realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&) + 328
realm::IntegerNode<realm::ArrayInteger, realm::Equal>::find_first_local(unsigned long, unsigned long) + 780
realm::ParentNode::aggregate_local(realm::QueryStateBase*, unsigned long, unsigned long, unsigned long, realm::ArrayPayload*) + 468
realm::Query::aggregate_internal(realm::ParentNode*, realm::QueryStateBase*, unsigned long, unsigned long, realm::ArrayPayload*) const + 212
realm::util::FunctionRef<realm::IteratorControl (realm::Cluster const*)>::FunctionRef<realm::Query::do_find_all(realm::TableView&, unsigned long) const::$_3&>(realm::Query::do_find_all(realm::TableView&, unsigned long) const::$_3&)::{lambda(void*, realm::Cluster const*)#1}::__invoke(void*, realm::Cluster const*) + 100
realm::ClusterNodeInner::traverse(realm::util::FunctionRef<realm::IteratorControl (realm::Cluster const*)>, long long) const + 620
realm::ClusterNodeInner::traverse(realm::util::FunctionRef<realm::IteratorControl (realm::Cluster const*)>, long long) const + 264
realm::ClusterTree::traverse(realm::util::FunctionRef<realm::IteratorControl (realm::Cluster const*)>) const + 104
realm::Query::do_find_all(realm::TableView&, unsigned long) const + 964
realm::TableView::do_sync() + 536
realm::Query::find_all(unsigned long) const + 84
realm::Query::find_all(realm::DescriptorOrdering const&) const + 224
realm::Results::ensure_up_to_date(realm::Results::EvaluateMode) + 420
std::__1::optional<realm::Obj> realm::Results::try_get<realm::Obj>(unsigned long) + 48
std::__1::optional<realm::Obj> realm::Results::first<realm::Obj>() + 56
auto realm::Results::first<RLMAccessorContext>(RLMAccessorContext&)::{lambda(auto:1&)#1} realm::Results::dispatch<auto realm::Results::first<RLMAccessorContext>(RLMAccessorContext&)::{lambda(auto:1&)#1}>(auto realm::Results::first<RLMAccessorContext>(RLMAccessorContext&)::{lambda(auto:1&)#1}&) const (optional:296)
auto realm::Results::first<RLMAccessorContext>(RLMAccessorContext&) (results.hpp:456)
-[RLMResults firstObject] (RLMResults.mm:249)

@Jaycyn
Copy link

Jaycyn commented Nov 2, 2023

Can you post the code that causes the crash? A small example would be helpful.

And to clarify, you were using Realm 2.8.2 (from 2017?) and upgraded to 10.32.3?

@xiaoquan7791
Copy link
Author

xiaoquan7791 commented Nov 3, 2023

Can you post the code that causes the crash? A small example would be helpful.

And to clarify, you were using Realm 2.8.2 (from 2017?) and upgraded to 10.32.3?

1、using Realm 2.8.2 from 2017 :YES , and update realm to 10.32.3 in September 2023;
2、crash code :

void run_block_in_queue(dispatch_queue_t queue, dispatch_block_t block) {
    if (is_same_queue(queue)) {
        block();
    }
    else {
        dispatch_sync(queue, block);
    }
}

dispatch_queue_t dbQueue = dispatch_queue_create(@"db_queue".UTF8String, NULL);
dispatch_queue_set_specific(customQueue, queueNameKey, (__bridge void *)(name), NULL);
int key1 = 1
NSString *key2 = @"123"; 
run_block_in_queue(dbQueue, ^{
        @try {
            [RLMRealm defaultRealm];
            RLMResults *results = [ExampObj objectsWhere:@"key1 == %d AND key2 == %@", key1, key2];
        if (results.firstObject) {
            //todo
        }
        }
        @catch (NSException *exception) {
        }
        @finally {
        }
   });

in our app all realm update add search is in the dbQueue

Online users, there are approximately hundreds of devices experiencing such crashes(Startup crash ),and Remove and reinstall The app can be used normally;
Is the database file damaged?if yes, Is there a method to identify database file corruption?

and if we upgrade realm to v 10.44.0 the latest,can fix this crash ?

@Jaycyn
Copy link

Jaycyn commented Nov 3, 2023

Can you try opening the database filed with Realm Studio? Report back your results.

@xiaoquan7791
Copy link
Author

Can you try opening the database filed with Realm Studio? Report back your results.

NO, casue our testing equipment has never encountered such crashes, which are all encountered by online users, and we cannot obtain the relevant cache files
Do you have any suggestions?

@xiaoquan7791
Copy link
Author

Can you try opening the database filed with Realm Studio? Report back your results.

All crash is in realm core, if realm (update / delete / search) crash once,it will always crash on there. it the realm core problem?

@nirinchev
Copy link
Member

@jedelbo do these Core crashes seem to be caused by database corruption or is there something meaningful we can do with them? Note that this is upgrading a database from Core v2.8.1 to 12.9.0. Should we advise them to try and update to the latest version of the SDK?

@nirinchev nirinchev self-assigned this Feb 6, 2024
@sync-by-unito sync-by-unito bot added More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Mar 14, 2024
Copy link

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Encryption:Off Frequency:Always More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community Repro:Always SDK-Use:Local T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed
Projects
None yet
Development

No branches or pull requests

3 participants