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

realm::ArrayString::init_from_mem(realm::MemRef) #6789

Closed
ganesh-ananthan opened this issue Sep 19, 2020 · 5 comments
Closed

realm::ArrayString::init_from_mem(realm::MemRef) #6789

ganesh-ananthan opened this issue Sep 19, 2020 · 5 comments
Assignees

Comments

@ganesh-ananthan
Copy link

ganesh-ananthan commented Sep 19, 2020

Application got crashed while reading value from Realm DB.

Incident Identifier: a69ccae1-7d5d-46d3-ad14-3db8a2df56e5
CrashReporter Key: C772B1E2-B411-4F6A-B0A5-E9B600C068F8
Hardware Model: iPhone8,1
Process: AppName [628]
Path: /var/containers/Bundle/Application/298D5259-2E06-4070-B2C5-3F043D703E8B/AppName.app/AppName
Identifier: com.domain.phone2
Version: 4.0.960 (4.0.960)
Code Type: arm64
Parent Process: ??? [1]

Date/Time: 2020-09-19T01:02:07.999Z
Launch Time: 2020-09-18T20:28:25Z
OS Version: iPhone OS 12.4 (16G77)
Report Version: 104

Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x0
Crashed Thread: 15

Thread 15 Crashed:
0 ??? 0x0000000000000000 0x0 + 0
1 Realm 0x0000000104178084 realm::ArrayString::init_from_mem(realm::MemRef) + 604
2 Realm 0x0000000104179d34 realm::ArrayString::init_from_ref(unsigned long) + 128
3 Realm 0x0000000104187e60 realm::Cluster::init_leaf(realm::ColKey, realm::ArrayPayload*) const + 180
4 Realm 0x00000001042115ac realm::StringNodeEqualBase::cluster_changed() + 108
5 Realm 0x000000010408ec44 realm::ParentNode::set_cluster(realm::Cluster const*) + 28
6 Realm 0x000000010408ef5c realm::ParentNode::set_cluster(realm::Cluster const*) + 820
7 Realm 0x000000010408990c realm::Query::find_all(realm::ConstTableView&, unsigned long, unsigned long, unsigned long) const + 792
8 Realm 0x000000010425773c realm::ConstTableView::do_sync() + 416
9 Realm 0x0000000104089a40 realm::Query::find_all(unsigned long, unsigned long, unsigned long) + 104
10 Realm 0x0000000104089ec0 realm::Query::find_all(realm::DescriptorOrdering const&) + 236
11 Realm 0x0000000103f854a4 realm::Results::do_evaluate_query_if_needed(bool) (results.cpp:383)
12 Realm 0x0000000103f8a544 realm::Results::evaluate_query_if_needed(bool) (results.cpp:360)
13 Realm 0x0000000104029114 -[RLMResults countByEnumeratingWithState:objects:count:] (RLMResults.mm:183)
14 libswiftFoundation.dylib 0x0000000225873948 Foundation.NSFastEnumerationIterator.next() -> Any? + 188
15 RealmSwift 0x00000001047a8e88 RealmSwift.RLMIterator.next() -> A? (RealmCollection.swift:34)
16 AppName 0x0000000102d90d68 function signature specialization <Arg[3] = Dead> of generic specialization <AppName.Message> of AppName.UnifiedDatabase.fetch(predicate: __C.NSPredicate?, sortDescriptors: [RealmSwift.SortDescriptor]?, count: Swift.Int?) > [A.ModelType] (<compilergenerated>:0)
17 AppName 0x000000010266b6e0 function signature specialization <Arg[0] = Exploded> of AppName.MessagesDao.getUnreadMessagesCountExcludingUndownloadedFts(conversationId: Swift.String) > Swift.Int (<compilergenerated>:0)
18 AppName 0x00000001023d3780 0x102054000 + 3667840
19 AppName 0x00000001023d1680 0x102054000 + 3659392
20 AppName 0x00000001023aa838 closure #1 (AppName.ItemResult<AppName.ConversationModel>) > () in AppName.MessagingListInteractor.initializeAllConversations(completion: (AppName.ItemResult<AppName.ConversationModel>) > (), onInitialLoadComplete: () > ()) > () (MessagingListInteractor.swift:211)
21 AppName 0x0000000102247518 closure #1 ([AppName.ConversationModel]) -> () in closure #3 (Swift.String) > () in AppName.MessagesDao.rx_initializeAllConversations(completion: (AppName.ItemResult<AppName.ConversationModel>) > (), onInitialLoadComplete: () > ()) > () (MessagesDao.swift:327)
22 AppName 0x000000010227b704 partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed [AppName.ConversationModel]) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed [AppName.ConversationModel]) > (@out (), @error @owned Swift.Error) (<compilergenerated>:0)
23 RxSwift 0x0000000104bde750 RxSwift.(MapSink in _5428EFA9A9B0C0340021B871D2E5AC01).on(RxSwift.Event) -> () (Map.swift:43)
24 RxSwift 0x0000000104bde924 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>) > () in conformance RxSwift.(MapSink in _5428EFA9A9B0C0340021B871D2E5AC01)<A, B> : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)
25 RxSwift 0x0000000104beb764 partial apply forwarder (:0)
26 RxSwift 0x0000000104c07990 partial apply forwarder for reabstraction thunk helper <A1 where A == A1.Element, A1: RxSwift.ObserverType> from @escaping @callee_guaranteed (@in_guaranteed RxSwift.Event) -> () to @escaping @callee_guaranteed (@in_guaranteed RxSwift.Event) > (@out ()) (<compilergenerated>:0)
27 RxSwift 0x0000000104c06878 merged RxSwift.(ShareReplay1WhileConnectedConnection in _E9FE621655D67A613BF2FC2D9B3041FC).on(RxSwift.Event) -> () + 112
28 RxSwift 0x0000000104c063a4 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>) > () in conformance RxSwift.(ShareReplay1WhileConnectedConnection in _E9FE621655D67A613BF2FC2D9B3041FC) : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)
29 RxSwift 0x0000000104c0b044 RxSwift.Sink.forwardOn(RxSwift.Event<A.Element>) -> () (Sink.swift:34)
30 RxSwift 0x0000000104be3ad4 RxSwift.(MergeSinkIter in _DDEA0423368B3B462AE46699A4D080E1).on(RxSwift.Event<B.Element>) -> () (Merge.swift:394)
31 RxSwift 0x0000000104be3c58 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>) > () in conformance RxSwift.(MergeSinkIter in _DDEA0423368B3B462AE46699A4D080E1)<A, B, C> : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)
32 RxSwift 0x0000000104bdcab4 RxSwift.(Just in _BD9B9D4356C4038796FB16D0D54A9F8E).subscribe<A where A == A1.Element, A1: RxSwift.ObserverType>(A1) -> RxSwift.Disposable (Just.swift:83)
33 RxSwift 0x0000000104be316c RxSwift.(MergeSink in _DDEA0423368B3B462AE46699A4D080E1).subscribeInner(RxSwift.Observable<B.Element>) -> () (Merge.swift:477)
34 RxSwift 0x0000000104be2f9c RxSwift.(MergeSink in _DDEA0423368B3B462AE46699A4D080E1).on(RxSwift.Event) -> () (Merge.swift:459)
35 RxSwift 0x0000000104be3d84 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>) > () in conformance RxSwift.(MergeSink in _DDEA0423368B3B462AE46699A4D080E1)<A, B, C> : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)
36 RxSwift 0x0000000104c0b044 RxSwift.Sink.forwardOn(RxSwift.Event<A.Element>) -> () (Sink.swift:34)
37 RxSwift 0x0000000104bde7dc RxSwift.(MapSink in _5428EFA9A9B0C0340021B871D2E5AC01).on(RxSwift.Event) -> () (Map.swift:44)
38 RxSwift 0x0000000104bde924 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>) > () in conformance RxSwift.(MapSink in _5428EFA9A9B0C0340021B871D2E5AC01)<A, B> : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)
39 RxSwift 0x0000000104c0b044 RxSwift.Sink.forwardOn(RxSwift.Event<A.Element>) -> () (Sink.swift:34)
40 RxSwift 0x0000000104bd7444 RxSwift.(FilterSink in _172A575932639FDD42969ED91F7BE949).on(RxSwift.Event<A.Element>) -> () (Filter.swift:60)
41 RxSwift 0x0000000104bd7578 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>) > () in conformance RxSwift.(FilterSink in _172A575932639FDD42969ED91F7BE949) : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)
42 RxSwift 0x0000000104beb764 partial apply forwarder (:0)
43 RxSwift 0x0000000104c07990 partial apply forwarder for reabstraction thunk helper <A1 where A == A1.Element, A1: RxSwift.ObserverType> from @escaping @callee_guaranteed (@in_guaranteed RxSwift.Event) -> () to @escaping @callee_guaranteed (@in_guaranteed RxSwift.Event) > (@out ()) (<compilergenerated>:0)
44 RxSwift 0x0000000104c06878 merged RxSwift.(ShareReplay1WhileConnectedConnection in _E9FE621655D67A613BF2FC2D9B3041FC).on(RxSwift.Event) -> () + 112
45 RxSwift 0x0000000104c063a4 protocol witness for RxSwift.ObserverType.on(RxSwift.Event<A.Element>) > () in conformance RxSwift.(ShareReplay1WhileConnectedConnection in _E9FE621655D67A613BF2FC2D9B3041FC) : RxSwift.ObserverType in RxSwift (<compilergenerated>:0)
46 RxSwift 0x0000000104be9d90 RxSwift.(ObserveOnSink in 277A93ABA8477198C125F3F26B2D4B62).run((), (()) > ()) > () (ObserveOn.swift:117)
47 RxSwift 0x0000000104beafd0 partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@unowned @callee_guaranteed () -> ()) > () to @escaping @callee_guaranteed (@in_guaranteed (), @unowned @callee_guaranteed (@in_guaranteed ()) > ()) > () (<compilergenerated>:0)
48 RxSwift 0x0000000104bf8dc0 partial apply forwarder for reabstraction thunk helper
from @escaping @callee_guaranteed (@in_guaranteed A, @unowned @callee_guaranteed (@in_guaranteed A) -> ()) > () to @escaping @callee_guaranteed (@in_guaranteed A, @in_guaranteed @callee_guaranteed (@in_guaranteed A) > (@out ())) > (@out ()) (<compilergenerated>:0)
49 RxSwift 0x0000000104bf86f8 closure #1 (A) -> RxSwift.Disposable in RxSwift.RecursiveImmediateScheduler.schedule(A) > () (<compilergenerated>:0)
50 RxSwift 0x0000000104bd0e68 closure #1 () -> () in RxSwift.DispatchQueueConfiguration.schedule(
: A, action: (A) > RxSwift.Disposable) > RxSwift.Disposable (DispatchQueueConfiguration.swift:27)
51 RxSwift 0x0000000104bc3fec reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () > () (<compilergenerated>:0)
52 libdispatch.dylib 0x00000001f7448a38 _dispatch_call_block_and_release + 20
53 libdispatch.dylib 0x00000001f74497d4 _dispatch_client_callout + 12
54 libdispatch.dylib 0x00000001f73ee01c _dispatch_continuation_pop$VARIANT$mp + 408
55 libdispatch.dylib 0x00000001f73ed6e0 _dispatch_async_redirect_invoke + 596
56 libdispatch.dylib 0x00000001f73fa030 _dispatch_root_queue_drain + 368
57 libdispatch.dylib 0x00000001f73fa8d4 _dispatch_worker_thread2 + 124
58 libsystem_pthread.dylib 0x00000001f762a1b4 _pthread_wqthread + 460
59 libsystem_pthread.dylib 0x00000001f762ccd4 start_wqthread + 0

@leemaguire
Copy link
Contributor

@ganesh-ananthan Can you tell us what version of Realm you are using? If you are using Sync and could you please post the Swift code that leads up to this crash. Thanks

@ganesh-ananthan
Copy link
Author

We are using Realm v 5.4.1 and below are the code for fetch the result from realm

`func fetch(predicate: NSPredicate? = nil, sortDescriptors: [SortDescriptor]? = [], count:Int?=0) -> [T.ModelType] {
guard let realm = self.realm else {
return []
}
var objects = realm.objects(T.self)
if let predicate = predicate {
objects = objects.filter(predicate)
}

    if let sortDescriptors = sortDescriptors, sortDescriptors.count > 0 {
        objects = objects.sorted(by: sortDescriptors)
    }
    
    if let count = count, count > 0 {
        return objects.prefix(count).compactMap {
            $0.modelObject
        }
    }
    
    return objects.compactMap {
        $0.modelObject
    }
}`

@leemaguire
Copy link
Contributor

@ganesh-ananthan thanks for the code sample. I am unfortunately unable to reproduce the issue. Would you be able to send us your Realm models to help us debug better? You can either paste them here or send them privately if you wish to [email protected]

Thanks

@tgoyne
Copy link
Member

tgoyne commented Sep 25, 2020

This should be fixed in 5.4.4.

@tgoyne tgoyne closed this as completed Sep 25, 2020
@ganesh-ananthan
Copy link
Author

@tgoyne We have upgraded to 5.5.0 , still we have same issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 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

3 participants