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

Encrypted realm crashes in shared folder. please_report_this_issue_in_github_realm_realm_core_v_14_5_2 + 10 #8729

Open
caravaneer404 opened this issue Dec 11, 2024 · 0 comments

Comments

@caravaneer404
Copy link

How frequently does the bug occur?

Always

Description

Hello, my application used to use two realm files, one encrypted in the main application, one in the shared folder because previously it was not possible to use an encrypted database in the shared folder. Several releases ago, support for encrypted database in a shared folder was added to Realm, so I rewrote the application to work with one encrypted realm file, which stored in shared folder. The application database has many models and a large amount of data, there are constant writes/reads and multiple observers + frequent read/write from Push Extension. I didn't notice any crashes until I submitted the branch for beta testing, but now we have 100 crashes from 4 users in 30 days. Unfortunately, as usual, I can't reproduce this crash with the Xcode connected and I don't understand what is causing it. Apart from the transition to storing the realm file in another place, there were no changes, the development branch is stable and doesn't have these crashes.

OFFTOP: sometimes the error does not contain a stack trace, but just looks like this:

Fatal Exception: realm::util::DecryptionFailed
Decryption failed: 'unable to decrypt after 0 seconds (retry_count=0, from=i != bytes_read, size=16384)'

Stacktrace & log output

Crashed: Write queue (QOS: DEFAULT)
0  libsystem_kernel.dylib                        0xc2ec __pthread_kill + 8
1  libsystem_pthread.dylib                       0x7c0c pthread_kill + 268
2  libsystem_c.dylib                             0x75ba0 abort + 180
3  RealmCore_-21EF7F57EA13237D_PackageProduct    0x33f434 please_report_this_issue_in_github_realm_realm_core_v_14_5_2 + 10
4  RealmCore_-21EF7F57EA13237D_PackageProduct    0x33f674 realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char>>&) + 244
5  RealmCore_-21EF7F57EA13237D_PackageProduct    0x33f554 realm::util::terminate_with_info(char const*, char const*, long, char const*, std::initializer_list<realm::util::Printable>&&) + 268
6  RealmCore_-21EF7F57EA13237D_PackageProduct    0x33f448 realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&) + 18
7  RealmCore_-21EF7F57EA13237D_PackageProduct    0x32585c realm::util::EncryptedFileMapping::~EncryptedFileMapping() + 224
8  RealmCore_-21EF7F57EA13237D_PackageProduct    0x33a8d0 std::__1::shared_ptr<realm::util::EncryptedFileMapping>::~shared_ptr[abi:ue170006]() + 64
9  RealmCore_-21EF7F57EA13237D_PackageProduct    0x32eb88 realm::util::(anonymous namespace)::remove_mapping(void*, unsigned long) + 128
10 RealmCore_-21EF7F57EA13237D_PackageProduct    0x32ce74 realm::util::File::MapBase::unmap() + 56
11 RealmCore_-21EF7F57EA13237D_PackageProduct    0xc7530 realm::WriteWindowMgr::MapWindow::~MapWindow() + 28
12 RealmCore_-21EF7F57EA13237D_PackageProduct    0xcc0d4 std::__1::unique_ptr<realm::WriteWindowMgr::MapWindow, std::__1::default_delete<realm::WriteWindowMgr::MapWindow>>::reset[abi:ue170006](realm::WriteWindowMgr::MapWindow*) + 28
13 RealmCore_-21EF7F57EA13237D_PackageProduct    0xcbf64 std::__1::vector<std::__1::unique_ptr<realm::WriteWindowMgr::MapWindow, std::__1::default_delete<realm::WriteWindowMgr::MapWindow>>, std::__1::allocator<std::__1::unique_ptr<realm::WriteWindowMgr::MapWindow, std::__1::default_delete<realm::WriteWindowMgr::MapWindow>>>>::__destroy_vector::operator()[abi:ue170006]() + 64
14 RealmCore_-21EF7F57EA13237D_PackageProduct    0xc7e90 realm::GroupWriter::~GroupWriter() + 120
15 RealmCore_-21EF7F57EA13237D_PackageProduct    0xa9408 realm::DB::low_level_commit(unsigned long long, realm::Transaction&, bool) + 1320
16 RealmCore_-21EF7F57EA13237D_PackageProduct    0xa8e44 realm::DB::do_commit(realm::Transaction&, bool) + 228
17 RealmCore_-21EF7F57EA13237D_PackageProduct    0x311e1c realm::Transaction::commit_and_continue_as_read(bool) + 68
18 RealmCore_-21EF7F57EA13237D_PackageProduct    0x156b8c realm::_impl::RealmCoordinator::commit_write(realm::Realm&, bool) + 100
19 RealmCore_-21EF7F57EA13237D_PackageProduct    0x199444 realm::Realm::commit_transaction() + 108
20 Realm                                         0x137200 -[RLMRealm commitWriteTransactionWithoutNotifying:error:] + 248
21 RealmSwift_2113C04D615ECB08_PackageProduct    0x7c640 block_destroy_helper + 460
22 RealmSwift_2113C04D615ECB08_PackageProduct    0x7c55c block_destroy_helper + 232
23 ExpressDB                                     0x30c48 $s9ExpressDB12RealmManagerC5write_10completionyy0C5Swift0C0Vc_ys6ResultOyyts5Error_pGcSgtFyyYbcfU_yyXEfU_ + 104
24 ExpressDB                                     0x30b9c $s9ExpressDB12RealmManagerC5write_10completionyy0C5Swift0C0Vc_ys6ResultOyyts5Error_pGcSgtFyyYbcfU_ + 72
25 ExpressDB                                     0x30988 $sIegh_IeyBh_TR + 28
26 Foundation                                    0x1c8c0 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 24
27 Foundation                                    0x1c780 -[NSBlockOperation main] + 104
28 Foundation                                    0x1c580 __NSOPERATION_IS_INVOKING_MAIN__ + 16
29 Foundation                                    0x1a820 -[NSOperation start] + 648
30 Foundation                                    0x9f268 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 16
31 Foundation                                    0x9eeb4 __NSOQSchedule_f + 172
32 libdispatch.dylib                             0x12e5c _dispatch_block_async_invoke2 + 148
33 libdispatch.dylib                             0x3dd4 _dispatch_client_callout + 20
34 libdispatch.dylib                             0x72d8 _dispatch_continuation_pop + 600
35 libdispatch.dylib                             0x68f4 _dispatch_async_redirect_invoke + 584
36 libdispatch.dylib                             0x15894 _dispatch_root_queue_drain + 392
37 libdispatch.dylib                             0x1609c _dispatch_worker_thread2 + 156
38 libsystem_pthread.dylib                       0x48f8 _pthread_wqthread + 228
39 libsystem_pthread.dylib                       0x10cc start_wqthread + 8

Can you reproduce the bug?

No

Reproduction Steps

Most often crashes when returning to the application or when starting after app termination. Accroding to breadcrumbs the crash does not happen immediately, but after the screen with the UITable based on RLMNotificationToken

Version

14.5.2

What Atlas Services are you using?

Local Database only

Are you using encryption?

Yes

Platform OS and version(s)

ios 17, ios 18

Build environment

Xcode version: 15.3
Dependency manager and version: SPM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant