Crash on transaction
Crashed: com.apple.root.background-qos
0 Realm 0x1058abfb8 realm::Allocator::translate_less_critical(realm::Allocator::RefTranslation*, unsigned long) const + 68
1 Realm 0x1057fce30 realm::Array::init_from_ref(unsigned long) + 192
2 Realm 0x105ca356c realm::_impl::GroupFriend::get_history_ref(realm::Allocator&, unsigned long) + 68
3 Realm 0x105c3ba60 bool realm::Transaction::internal_advance_read<(anonymous namespace)::TransactLogValidator>((anonymous namespace)::TransactLogValidator*, realm::VersionID, realm::_impl::History&, bool) + 176
4 Realm 0x105c36400 realm::_impl::transaction::begin(std::__1::shared_ptrrealm::Transaction const&, realm::BindingContext*, realm::_impl::NotifierPackage&) + 416
5 Realm 0x105c2b77c realm::_impl::RealmCoordinator::promote_to_write(realm::Realm&) + 268
6 Realm 0x105ca1570 realm::Realm::begin_transaction() + 404
7 Realm 0x10588ee24 -[RLMRealm beginWriteTransactionWithError:] + 24
8 Inventa 0x10510b0a0 $s7Inventa15RealmDataHelperC33saveDataAA0I0CG_tFyycfU_Tf2i_n + 52
9 Inventa 0x1050c2c98 $sIeg_IeyB_TR + 20
10 libdispatch.dylib 0x19941c24c _dispatch_call_block_and_release + 32
11 libdispatch.dylib 0x19941ddb0 _dispatch_client_callout + 20
12 libdispatch.dylib 0x19942ea68 _dispatch_root_queue_drain + 656
13 libdispatch.dylib 0x19942f120 _dispatch_worker_thread2 + 116
14 libsystem_pthread.dylib 0x1e52d97d8 _pthread_wqthread + 216
15 libsystem_pthread.dylib 0x1e52e076c start_wqthread + 8
Code Sample
func saveAllEzoneDistinctNotifications(notifications: [Notifications]) {
var filtered:[Notifications] = []
for notif in notifications {
for stId in notif.st_ids {
notif.stId = stId
notif.notif_key = "\(notif.ntId)-\(notif.stId))"
filtered.append(notif)
}
}
let backgroundQueue = DispatchQueue.global(qos: .background)
backgroundQueue.async(execute: {
do{
let realm = try Realm()
realm.beginWrite()
realm.add(filtered, update: .all)
try realm.commitWrite()
}
catch{
print(error)
}
})
}
Exception Type: EXC_BAD_ACCESS
Exception Subtype: KERN_INVALID_ADDRESS 0x00000003d74249bd
Release Type: User
Realm framework version: 10.5.1
Xcode version: 12.3
iOS/OSX version: 14.3