realm-core: Randomly crash when append objects to list in write transaction

SDK and version

SDK : RealmSwift Version: 10.28.1

Observations

  • How frequent do the crash occur? Random, but always if happened in specific device
  • Does it happen in production or during dev/test? Production
  • Can the crash be reproduced by you? No
  • Can you provide instructions for how we can reproduce it? Not sure, but in this case just append some object into list.

Crash log / stacktrace

MAIN THREAD - CRASHED

libsystem_kernel.dylib
__pthread_kill
libsystem_c.dylib
abort
Realm
please_report_this_issue_in_github_realm_realm_core
Realm
realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)
Realm
realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&)
Realm
void realm::util::terminate<unsigned long long, unsigned long long>(char const*, char const*, long, unsigned long long, unsigned long long) terminate.hpp:45
Realm
realm::ArraySmallBlobs::insert(unsigned long, realm::BinaryData, bool)
Realm
void realm::Cluster::do_insert_row<realm::ArrayString>(unsigned long, realm::ColKey, realm::Mixed, bool)
Realm
realm::util::FunctionRef<bool (realm::ColKey)>::FunctionRef<realm::Cluster::insert_row(unsigned long, realm::ObjKey, realm::FieldValues const&)::$_1&>(realm::Cluster::insert_row(unsigned long, realm::ObjKey, realm::FieldValues const&)::$_1&&&)::'lambda'(void*, realm::ColKey)::__invoke(void*, realm::ColKey)
Realm
realm::TableClusterTree::for_each_and_every_column(realm::util::FunctionRef<bool (realm::ColKey)>) const
Realm
realm::Cluster::insert_row(unsigned long, realm::ObjKey, realm::FieldValues const&)
Realm
realm::Cluster::insert(realm::ObjKey, realm::FieldValues const&, realm::ClusterNode::State&)
Realm
realm::ClusterNodeInner::insert(realm::ObjKey, realm::FieldValues const&, realm::ClusterNode::State&)::$_1::operator()(realm::ClusterNode*, realm::ClusterNodeInner::ChildInfo&) const
Realm
realm::ClusterNodeInner::insert(realm::ObjKey, realm::FieldValues const&, realm::ClusterNode::State&)
Realm
realm::ClusterTree::insert_fast(realm::ObjKey, realm::FieldValues const&, realm::ClusterNode::State&)
Realm
realm::ClusterTree::insert(realm::ObjKey, realm::FieldValues const&)
Realm
realm::TableClusterTree::insert(realm::ObjKey, realm::FieldValues const&)
Realm
realm::Table::create_object_with_primary_key(realm::Mixed const&, realm::FieldValues&&, realm::Table::UpdateMode, bool*)
Realm
realm::Table::create_object_with_primary_key(realm::Mixed const&, bool*) table.hpp:258
Realm
realm::Object realm::Object::create<objc_object* __strong, RLMAccessorContext>(RLMAccessorContext&, std::__1::shared_ptr<realm::Realm> const&, realm::ObjectSchema const&, objc_object* __strong, realm::CreatePolicy, realm::ObjKey, realm::Obj*) object_accessor.hpp:305
Realm
RLMAccessorContext::createObject(objc_object*, realm::CreatePolicy, bool, realm::ObjKey) RLMAccessor.mm:1102
Realm
realm::Obj RLMAccessorContext::unbox<realm::Obj>(objc_object*, realm::CreatePolicy, realm::ObjKey) RLMAccessor.mm:1134
Realm
auto realm::List::dispatch<void realm::List::insert<objc_object* const __strong&, RLMAccessorContext>(RLMAccessorContext&, unsigned long, objc_object* const __strong&&&, realm::CreatePolicy)::'lambda'(RLMAccessorContext&)>(objc_object* const __strong&) const list.hpp:212
Realm
void realm::List::insert<objc_object* const __strong&, RLMAccessorContext>(RLMAccessorContext&, unsigned long, objc_object* const __strong&&&, realm::CreatePolicy) list.hpp:211
Realm
___ZL15RLMInsertObjectP15RLMManagedArrayP11objc_objectm_block_invoke RLMManagedArray.mm:270
Realm
auto translateErrors<void () block_pointer __strong&>(void () block_pointer __strong&&&) RLMManagedArray.mm:181
Realm
changeArray(RLMManagedArray*, NSKeyValueChange, unsigned long, void () block_pointer) RLMManagedArray.mm:202
Realm
RLMInsertObject(RLMManagedArray*, objc_object*, unsigned long) RLMManagedArray.mm:268
Realm
-[RLMManagedArray addObject:] RLMManagedArray.mm:275
RealmSwift
RealmSwift.List.append(A) -> () List.swift:114

... My Production call stack, call `root.records.append(record)`

Steps & Code to Reproduce

In some device, just run:

let realm = try! Realm()
let root = findOrCreateRootObject() // create a custom root object
let record = RecordObject()

try! realm.write {
  root.account = currentAccount ?? ""
  root.records.append(record)
}

, and it happened

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Can you please tell the realm-swift version to be used for fixing this error? @jedelbo