-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
How frequently does the bug occur?
Sometimes
Description
Hi after upgrading realm from 10.32.3 to 10.44.0 we are seeing this crash start to happening. It happened when doing a filter of the realm Object. The function that triggers the crash is shown in here
private static func updateAccountList<T: Object>(_ list: List<T>, with objectIds: IdentifierDiff, realm: Realm) { let added: [T] = objectIds.addedIds.compactMap { realm.object(ofType: T.self, forPrimaryKey: $0) } let removed: [T] = objectIds.removedIds.compactMap { realm.object(ofType: T.self, forPrimaryKey: $0) } let addToAccount = added.filter { !list.contains($0) } list.append(objectsIn: addToAccount) removed.forEach { object in if let index = list.index(of: object) { list.remove(at: index) } } }
The line that trigger the crash is {{let addToAccount = added.filter
{ !list.contains($0) }}}
This function was called within a realm.write and it only start to having this crash after upgrade to 10.44.0.
Any help is much appreciated.
Stacktrace & log output
Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
Fatal Exception: std::bad_alloc 0 myApp 0x2f86ec FIRCLSProcessRecordAllThreads + 393 (FIRCLSProcess.c:393) 1 myApp 0x2f8acc FIRCLSProcessRecordAllThreads + 424 (FIRCLSProcess.c:424) 2 myApp 0x306520 FIRCLSHandler + 34 (FIRCLSHandler.m:34) 3 myApp 0x306374 __FIRCLSExceptionRecord_block_invoke + 232 (FIRCLSException.mm:232) 4 libdispatch.dylib 0x3fdc _dispatch_client_callout + 20 5 libdispatch.dylib 0x13574 _dispatch_lane_barrier_sync_invoke_and_complete + 56 6 myApp 0x305380 FIRCLSExceptionRecord + 234 (FIRCLSException.mm:234) 7 myApp 0x305090 FIRCLSTerminateHandler() + 404 (FIRCLSException.mm:404) 8 libc++abi.dylib 0x10f28 std::__terminate(void (*)()) + 20 9 libc++abi.dylib 0x10ec4 std::terminate() + 56 10 myApp 0x82aeb4 realm::NodeHeader::get_byte_size_from_header(char const*) + 116 (node_header.hpp:116) 11 myApp 0x835798 realm::QueryStateBase::match_pattern(unsigned long, unsigned long long) + 53 (query_state.hpp:53) 12 myApp 0x9c4b9c realm::Query::do_find_all(realm::QueryStateBase&) const + 1298 (query.cpp:1298) 13 myApp 0xaab048 realm::TableView::do_sync() + 487 (table_view.cpp:487) 14 myApp 0x9c4954 realm::Query::find_all(unsigned long) const + 1387 (query.cpp:1387) 15 myApp 0x91c1d0 realm::Results::ensure_up_to_date(realm::Results::EvaluateMode) + 308 (results.cpp:308) 16 myApp 0x92522c realm::Results::snapshot() && + 1027 (results.cpp:1027) 17 myApp 0x64e88c -[RLMFastEnumerator initWithBackingCollection:collection:classInfo:] + 68 (RLMCollection.mm:68) 18 myApp 0x66b92c -[RLMManagedArray fastEnumerator] + 484 (RLMManagedArray.mm:484) 19 myApp 0x64efd0 RLMFastEnumerate(NSFastEnumerationState*, unsigned long, id<RLMCollectionPrivate>) + 184 (RLMCollection.mm:184) 20 Foundation 0x336664 NSFastEnumerationIterator.next() + 184 21 myApp 0xb8ec30 specialized _ArrayProtocol.filter(_:) + 991236 (<compiler-generated>:991236) 22 myApp 0xb90d74 specialized static DataManager.updateAccountList<A>(_:with:realm:) + 600 (DataManager.swift:600)
Can you reproduce the bug?
No
Reproduction Steps
No response
Version
10.44.0
What Atlas Services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
iOS 16 and 17
Build environment
Xcode version: ...
Dependency manager and version: ...