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

Crash on app startup #5947

Closed
DavideCeresola opened this issue Oct 7, 2022 · 7 comments
Closed

Crash on app startup #5947

DavideCeresola opened this issue Oct 7, 2022 · 7 comments

Comments

@DavideCeresola
Copy link

DavideCeresola commented Oct 7, 2022

How frequently does the bug occur?

Sometimes

Description

Our app seems to crash on startup due to realm.
We are performing some deletions with the filter operator at the app startup in a background thread that seems to cause the crash.
We are not able to reproduce it at the moment but some users is complaining about it.

Stacktrace & log output

Thread 3 name:
Thread 3 Crashed:
0   libsystem_kernel.dylib        	0x00000002049de200 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x0000000214c1b1ac pthread_kill + 268 (pthread.c:1670)
2   libsystem_c.dylib             	0x00000001cf7d5ca0 abort + 180 (abort.c:118)
3   Realm                         	0x000000010a0bad44 please_report_this_issue_in_github_realm_realm_core_v_12_9_0 + 12
4   Realm                         	0x000000010a0bb02c realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 260
5   Realm                         	0x000000010a0bae8c realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&) + 328
6   Realm                         	0x0000000109e4624c void realm::util::terminate_with_info<char const&, unsigned long&>(char const*, int, char const*, char const*, char const&, unsigned long&) + 401996 (terminate.hpp:51)
7   Realm                         	0x0000000109f3f6f4 realm::Array::move(unsigned long, unsigned long, unsigned long) + 404
8   Realm                         	0x000000010a22db40 realm::util::FunctionRef<unsigned long (realm::BPlusTreeNode*, unsigned long)>::FunctionRef<realm::BPlusTree<long long>::erase(unsigned long)::'lambda'(realm::BPlusTreeNode*, unsigned long)&>(long ... + 36
9   Realm                         	0x0000000109f5e2a4 realm::BPlusTreeBase::bptree_erase(unsigned long, realm::util::FunctionRef<unsigned long (realm::BPlusTreeNode*, unsigned long)>) + 52
10  Realm                         	0x0000000109fa1cd0 realm::StringIndex::do_delete(realm::ObjKey, realm::StringData, unsigned long) + 956
11  Realm                         	0x0000000109fa2270 realm::StringIndex::erase(realm::ObjKey) + 156
12  Realm                         	0x000000010a06a88c realm::Table::erase_from_search_indexes(realm::ObjKey) + 76
13  Realm                         	0x0000000109f70c38 realm::ClusterTree::erase(realm::ObjKey, realm::CascadeState&) + 44
14  Realm                         	0x000000010a072660 realm::Table::batch_erase_rows(realm::BPlusTree<realm::ObjKey> const&) + 1136
15  Realm                         	0x000000010a08bcc4 realm::TableView::clear() + 144
16  Realm                         	0x000000010a1e409c realm::Results::clear() + 216
17  Realm                         	0x0000000109f15d9c -[RLMResults deleteObjectsFromRealm] + 1252764 (RLMResults.mm:498)
18  Realm                         	0x0000000109f0d854 -[RLMRealm deleteObjects:] + 144 (RLMRealm.mm:1014)
28  libdispatch.dylib             	0x00000001cf7704b4 _dispatch_call_block_and_release + 32 (init.c:1518)
29  libdispatch.dylib             	0x00000001cf771fdc _dispatch_client_callout + 20 (object.m:560)
30  libdispatch.dylib             	0x00000001cf7750c8 _dispatch_queue_override_invoke + 788 (inline_internal.h:2632)
31  libdispatch.dylib             	0x00000001cf783a6c _dispatch_root_queue_drain + 396 (inline_internal.h:0)
32  libdispatch.dylib             	0x00000001cf784284 _dispatch_worker_thread2 + 164 (queue.c:7052)
33  libsystem_pthread.dylib       	0x0000000214c14dbc _pthread_wqthread + 228 (pthread.c:2631)
34  libsystem_pthread.dylib       	0x0000000214c14b98 start_wqthread + 8

Can you reproduce the bug?

Not yet

Reproduction Steps

No response

Version

10.31.0

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

iOS

Build environment

Xcode version: XCode 14.0.1
Dependency manager and version: Cocoapods 1.11.3

@ericjordanmossman
Copy link
Contributor

@sedwo , I think your crash is different than @DavideCeresola 's.
Yours seems unable to find a table key when the realm is opened. Davide's crashes during a delete.
@sedwo Could you open a new issue in realm-core with all the details you provided here, including that you can supply the realm file?

@ericjordanmossman
Copy link
Contributor

@nicola-cab Is there a way to tell where in realm::Array::move this could be crashing from the stacktrace?
There's at least five places to crash there, but I'm not sure how to narrow down. Does the fact there's no error message that says "Assertion failed: end, <=, m_size" imply that this assertion is passing?

@sedwo
Copy link

sedwo commented Oct 17, 2022

@ericjordanmossman Looks to be similar to #5937. I'll move my comment content there.

@nicola-cab
Copy link
Member

I think both issues are suffering from the same bug, the database got corrupted. @sedwo on #5937 you are trying to open a database that initially got corrupted by realm 11.15 (which displays this corruption bug). Realm core 12.9 should be fine, but since the file got corrupted, there is nothing to prevent that crash to be happening when opening the file with any version of realm.
We are treating this very seriously in core and trying to get at the bottom of this.

@sedwo
Copy link

sedwo commented Oct 18, 2022

@nicola-cab I haven't really touched my database layer code in years but do run pod update to get the latest stable versions of Realm when we release. Let me know if there are any recovery options I can try.

@ericjordanmossman ericjordanmossman transferred this issue from realm/realm-swift Oct 18, 2022
@jedelbo
Copy link
Contributor

jedelbo commented Oct 19, 2022

Internal note: Error when erasing entry in StringIndex

@jedelbo
Copy link
Contributor

jedelbo commented Nov 17, 2022

Closed by #5993

@jedelbo jedelbo closed this as completed Nov 17, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants