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

Terminate Crash #7188

Closed
abbottkilroy opened this issue Dec 6, 2023 · 1 comment
Closed

Terminate Crash #7188

abbottkilroy opened this issue Dec 6, 2023 · 1 comment

Comments

@abbottkilroy
Copy link

SDK and version

SDK : Swift
Version: 10.33.0

Observations

This is our top most crash in Crashlytics. We did not see it during development.

Crash log / stacktrace

0 libsystem_kernel.dylib 0x6bbc __pthread_kill + 8
1 libsystem_pthread.dylib 0xd844 pthread_kill + 208
2 libsystem_c.dylib 0x1f6ac abort + 124
3 Libre3 0xb0f73c realm::util::terminate(char const*, char const*, long, std::initializer_listrealm::util::Printable&&) + 147 (terminate.cpp:147)
4 Libre3 0xb0fa7c realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits, std::__1::allocator >&) + 142 (terminate.cpp:142)
5 Libre3 0xb0fbf8 realm::util::terminate_with_info(char const*, char const*, long, char const*, std::initializer_listrealm::util::Printable&&) + 163 (terminate.cpp:163)
6 Libre3 0x88d378 realm::SlabAlloc::free_block(unsigned long, realm::SlabAlloc::FreeBlock*) + 579 (alloc_slab.cpp:579)
7 Libre3 0x88d154 realm::SlabAlloc::do_free(unsigned long, char*) + 529 (alloc_slab.cpp:529)
8 Libre3 0x8d6574 realm::WrappedAllocator::do_free(unsigned long, char*) + 395 (alloc.hpp:395)
9 Libre3 0x91703c realm::Node::do_copy_on_write(unsigned long) + 168 (node.cpp:168)
10 Libre3 0x891dc4 realm::Array::set(unsigned long, long long) + 979 (array.hpp:979)
11 Libre3 0x917010 realm::Node::do_copy_on_write(unsigned long) + 264 (node.hpp:264)
12 Libre3 0x916d88 realm::Node::alloc(unsigned long, unsigned long) + 81 (node.cpp:81)
13 Libre3 0x891c20 realm::Array::alloc(unsigned long, unsigned long) + 207 (array.hpp:207)
14 Libre3 0x89d374 realm::ArrayBlob::replace(unsigned long, unsigned long, char const*, unsigned long, bool) + 151 (array_blob.cpp:151)
15 Libre3 0x89e3c0 realm::ArraySmallBlobs::erase(unsigned long) + 858 (array.hpp:858)
16 Libre3 0x8b42c0 realm::util::FunctionRef<realm::IteratorControl (realm::ColKey)>::FunctionRef<realm::Cluster::erase(realm::ObjKey, realm::CascadeState&)::$3&>(realm::Cluster::erase(realm::ObjKey, realm::CascadeState&)::$3&)::'lambda'(void*, realm::ColKey)::__invoke(void*, realm::ColKey) + 30 (array_string.hpp:30)
17 Libre3 0xade8c8 realm::TableClusterTree::for_each_and_every_column(realm::util::FunctionRef<realm::IteratorControl (realm::ColKey)>) const + 119 (function_ref.hpp:119)
18 Libre3 0x8ae7b0 realm::Cluster::erase(realm::ObjKey, realm::CascadeState&) + 1539 (vector:1539)
19 Libre3 0x8bcd14 realm::ClusterNodeInner::erase(realm::ObjKey, realm::CascadeState&)::$3::operator()(realm::ClusterNode*, realm::ClusterNodeInner::ChildInfo&) const + 452 (cluster_tree.cpp:452)
20 Libre3 0x8b9428 realm::ClusterNodeInner::erase(realm::ObjKey, realm::CascadeState&) + 252 (cluster_tree.cpp:252)
21 Libre3 0x8bcd14 realm::ClusterNodeInner::erase(realm::ObjKey, realm::CascadeState&)::$3::operator()(realm::ClusterNode*, realm::ClusterNodeInner::ChildInfo&) const + 452 (cluster_tree.cpp:452)
22 Libre3 0x8b94d4 realm::ClusterNodeInner::erase(realm::ObjKey, realm::CascadeState&) + 259 (cluster_tree.cpp:259)
23 Libre3 0x8bbe40 realm::ClusterTree::erase(realm::ObjKey, realm::CascadeState&) + 958 (cluster_tree.cpp:958)
24 Libre3 0xad0614 realm::Table::batch_erase_rows(realm::BPlusTreerealm::ObjKey const&) + 108 (wrap_iter.h:108)
25 Libre3 0xae1488 realm::TableView::clear() + 391 (table_view.cpp:391)
26 Libre3 0x97d7d4 realm::Results::clear() + 663 (results.cpp:663)
27 Libre3 0x86262c -[RLMResults deleteObjectsFromRealm] + 499 (RLMResults.mm:499)
28 Libre3 0x85a43c -[RLMRealm deleteObjects:] + 1014 (RLMRealm.mm:1014)
29 Libre3 0x308020 closure #2 in RealmDatabase.purgeOldRecords(completion:) + 20 (Purgeable.swift:20)
30 Libre3 0x30aebc partial apply for closure #2 in RealmDatabase.purgeOldRecords(completion:) + 4308430524 (:4308430524)
31 Libre3 0x30c5f8 thunk for @callee_guaranteed () -> (@error @owned Error)partial apply + 4308436472
32 Libre3 0xe35e94 Realm.write(withoutNotifying:
:) + 258 (Realm.swift:258)
33 Libre3 0x309234 closure #1 in Realm.safeWrite(type:
:) + 4308423220
34 Libre3 0x30aee0 partial apply for closure #1 in Realm.safeWrite(type:
:) + 4308430560
35 libswiftDispatch.dylib 0x183c + 20
36 libswiftDispatch.dylib 0x1854 + 12
37 libswiftDispatch.dylib 0x29ac + 120
38 libswiftDispatch.dylib 0x2a74 + 20
39 libswiftDispatch.dylib 0x2478 + 20
40 libdispatch.dylib 0x64094 + 16
41 libdispatch.dylib 0x11d24 + 60
42 libdispatch.dylib 0x1183c + 164
43 libswiftDispatch.dylib 0x1e18 + 152
44 libswiftDispatch.dylib 0x10ac + 40
45 libswiftDispatch.dylib 0x1bb0 + 256
46 libswiftDispatch.dylib 0x1140 $sSo17OS_dispatch_queueC8DispatchE4sync7executexxyKXE_tKlF + 140
47 Libre3 0x309d08 specialized RealmDatabase.purgeOldRecords(completion:) + 287 (RealmDatabase.swift:287)
48 Libre3 0x1523e4 specialized closure #2 in closure #1 in closure #1 in LibreviewManager.handlePendingUploads() + 201 (LibreviewManager.swift:201)
49 Libre3 0x254164 partial apply for closure #1 in NewYuAPIClient.upload(measurements:completion:) + 542 (NewYuAPIClient.swift:542)
50 Libre3 0x24ea78 closure #1 in NewYuAPIClient.performLibreviewRequest(:processInvalidDevice:completion:) + 715 (NewYuAPIClient.swift:715)
51 Libre3 0x72acdc thunk for @escaping @callee_guaranteed @sendable (@guaranteed Data?, @guaranteed NSURLResponse?, @guaranteed Error?) -> () + 4312755420 (:4312755420)
52 CFNetwork 0x1f79c CFURLRequestSetMainDocumentURL + 2312
53 CFNetwork 0x2fca8 _CFNetworkErrorCopyLocalizedDescriptionWithHostname + 11296
54 libdispatch.dylib 0x63094 + 24
55 libdispatch.dylib 0x64094 + 16
56 libdispatch.dylib 0xa73c + 644
57 libdispatch.dylib 0xb224 + 456
58 libdispatch.dylib 0x14ec8 + 632
59 libsystem_pthread.dylib 0x1e00 _pthread_wqthread + 284
60 libsystem_pthread.dylib 0x192c start_wqthread + 8

Steps & Code to Reproduce

This is our Libre3 app. Looks like it happens when we call:

func purgeRecordsBefore<T>(entityClass: T.Type, realm: Realm, earliestToKeepUTC: Int64) where T: RealmSwift.Object {
    // Log.v("Delete data before : \(earliestToKeepUTC)")
    realm.delete(realm
        .objects(entityClass)
        .filter("_timestampUTC<%@", earliestToKeepUTC))
}
@kiburtse
Copy link
Contributor

kiburtse commented Dec 7, 2023

Hi! Thanks for reporting the crash. This issue existed for quite a while in realm core, and it was very difficult to track it down unfortunately.

It's fixed by #6962 and released with realm core v13.20.1. You would need to update swift sdk for your app. It is fixed since swift sdk v10.42.2.

Please, reopen if you still experience this issues after an update.

@kiburtse kiburtse closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2023
@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

2 participants