Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-1294

Crash on open Realm

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      How frequently does the bug occur?

      Seen once

      Description

      The app starts crashing during opening Realm object.

      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
      Thread 7 name:
      Thread 7 Crashed:
      0   libsystem_kernel.dylib        	0x00000001b7726964 __pthread_kill + 8 (:-1)
      1   libsystem_pthread.dylib       	0x00000001f1310378 pthread_kill + 268 (pthread.c:1610)
      2   libsystem_c.dylib             	0x000000018b616420 __abort + 128 (abort.c:155)
      3   libsystem_c.dylib             	0x000000018b5bef5c abort + 176 (abort.c:126)
      4   Zerofy DEV                    	0x0000000102c7c1fc please_report_this_issue_in_github_realm_realm_core_v_12_9_0 + 12 (terminate.cpp:65)
      5   Zerofy DEV                    	0x0000000102c7c53c realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 244 (terminate.cpp:142)
      6   Zerofy DEV                    	0x0000000102c7c6b8 realm::util::terminate_with_info(char const*, char const*, long, char const*, std::initializer_list<realm::util::Printable>&&) + 256 (terminate.cpp:163)
      7   Zerofy DEV                    	0x00000001029f8ce0 void realm::util::terminate_with_info<unsigned long&, unsigned long&, unsigned long const&, unsigned long&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(c... + 136 (terminate.hpp:52)
      8   Zerofy DEV                    	0x00000001029f8abc realm::SlabAlloc::do_free(unsigned long, char*) + 1084 (alloc_slab.cpp:529)
      9   Zerofy DEV                    	0x00000001029fccc8 realm::Allocator::free_(unsigned long, char const*) + 32 (alloc.hpp:524)
      10  Zerofy DEV                    	0x00000001029fccc8 realm::Allocator::free_(realm::MemRef) + 32 (alloc.hpp:529)
      11  Zerofy DEV                    	0x00000001029fccc8 realm::Array::destroy_deep(realm::MemRef, realm::Allocator&) + 40 (array.hpp:896)
      12  Zerofy DEV                    	0x00000001029fccc8 realm::Array::destroy_deep(unsigned long, realm::Allocator&) + 164 (array.hpp:890)
      13  Zerofy DEV                    	0x00000001029fcc04 realm::Array::destroy_children(unsigned long) + 84 (array.cpp:275)
      14  Zerofy DEV                    	0x00000001029fcd24 realm::Array::destroy_deep() + 28 (array.hpp:815)
      15  Zerofy DEV                    	0x00000001029fcd24 realm::Array::destroy_deep(realm::MemRef, realm::Allocator&) + 132 (array.hpp:901)
      16  Zerofy DEV                    	0x00000001029fcd24 realm::Array::destroy_deep(unsigned long, realm::Allocator&) + 256 (array.hpp:890)
      17  Zerofy DEV                    	0x00000001029fcc04 realm::Array::destroy_children(unsigned long) + 84 (array.cpp:275)
      18  Zerofy DEV                    	0x00000001029fcd24 realm::Array::destroy_deep() + 28 (array.hpp:815)
      19  Zerofy DEV                    	0x00000001029fcd24 realm::Array::destroy_deep(realm::MemRef, realm::Allocator&) + 132 (array.hpp:901)
      20  Zerofy DEV                    	0x00000001029fcd24 realm::Array::destroy_deep(unsigned long, realm::Allocator&) + 256 (array.hpp:890)
      21  Zerofy DEV                    	0x00000001029fcc04 realm::Array::destroy_children(unsigned long) + 84 (array.cpp:275)
      22  Zerofy DEV                    	0x0000000102a084f8 realm::Array::destroy_deep() + 28 (array.hpp:815)
      23  Zerofy DEV                    	0x0000000102a084f8 realm::Array::destroy_deep(realm::MemRef, realm::Allocator&) + 152 (array.hpp:901)
      24  Zerofy DEV                    	0x0000000102a08058 realm::Array::destroy_deep(unsigned long, realm::Allocator&) + 112 (array.hpp:890)
      25  Zerofy DEV                    	0x0000000102a08058 realm::ArrayBigBlobs::erase(unsigned long) + 152 (array_blobs_big.hpp:133)
      26  Zerofy DEV                    	0x0000000102a08058 realm::ArrayBinary::erase(unsigned long) + 188 (array_binary.cpp:147)
      27  Zerofy DEV                    	0x0000000102a48c08 realm::BPlusTree<realm::BinaryData>::erase(unsigned long)::'lambda'(realm::BPlusTreeNode*, unsigned long)::operator()(realm::BPlusTreeNode*, unsigned long) const + 16 (bplustree.hpp:459)
      28  Zerofy DEV                    	0x0000000102a48c08 realm::util::FunctionRef<unsigned long (realm::BPlusTreeNode*, unsigned long)>::FunctionRef<realm::BPlusTree<realm::BinaryData>::erase(unsigned long)::'lambda'(realm::BPlusTreeNode*, unsigned long)... + 16 (function_ref.hpp:106)
      29  Zerofy DEV                    	0x0000000102a48c08 realm::util::FunctionRef<unsigned long (realm::BPlusTreeNode*, unsigned long)>::FunctionRef<realm::BPlusTree<realm::BinaryData>::erase(unsigned long)::'lambda'(realm::BPlusTreeNode*, unsigned long)... + 28 (function_ref.hpp:105)
      30  Zerofy DEV                    	0x0000000102a16c04 realm::BPlusTreeBase::bptree_erase(unsigned long, realm::util::FunctionRef<unsigned long (realm::BPlusTreeNode*, unsigned long)>) + 52 (bplustree.cpp:737)
      31  Zerofy DEV                    	0x0000000102a48828 realm::BPlusTree<realm::BinaryData>::erase(unsigned long) + 20 (bplustree.hpp:463)
      32  Zerofy DEV                    	0x0000000102a48828 (anonymous namespace)::InRealmHistory::set_oldest_bound_version(unsigned long long) + 164 (history.cpp:165)
      33  Zerofy DEV                    	0x0000000102a2f710 realm::DB::low_level_commit(unsigned long long, realm::Transaction&, bool) + 220 (db.cpp:2238)
      34  Zerofy DEV                    	0x0000000102a2f5a8 realm::DB::do_commit(realm::Transaction&, bool) + 232 (db.cpp:2142)
      35  Zerofy DEV                    	0x0000000102c517e8 realm::Transaction::commit() + 80 (transaction.cpp:154)
      36  Zerofy DEV                    	0x0000000102abc418 realm::_impl::RealmCoordinator::open_db() + 1680 (realm_coordinator.cpp:484)
      37  Zerofy DEV                    	0x0000000102abd018 realm::_impl::RealmCoordinator::do_get_realm(realm::RealmConfig, std::__1::shared_ptr<realm::Realm>&, std::__1::optional<realm::VersionID>, realm::util::CheckedUniqueLock&) + 68 (realm_coordinator.cpp:280)
      38  Zerofy DEV                    	0x0000000102abcea8 realm::_impl::RealmCoordinator::get_realm(realm::RealmConfig, std::__1::optional<realm::VersionID>) + 340 (realm_coordinator.cpp:252)
      39  Zerofy DEV                    	0x0000000102b1f2a8 realm::Realm::get_shared_realm(realm::RealmConfig) + 120 (shared_realm.cpp:157)
      40  Zerofy DEV                    	0x00000001029c32b0 +[RLMRealm realmWithConfiguration:queue:error:] + 1024 (RLMRealm.mm:532)
      41  Zerofy DEV                    	0x000000010325892c @nonobjc RLMRealm.__allocating_init(configuration:queue:) + 72 (<compiler-generated>:0)
      42  Zerofy DEV                    	0x0000000103258e3c Realm.init(configuration:queue:) + 104 (Realm.swift:95)
      43  Zerofy DEV                    	0x000000010246fd70 static Realm.createFBRealmAuxilaryInstance(queue:) + 120 (FBRealmAuxiliary.swift:36)
      44  Zerofy DEV                    	0x00000001024a8b5c RealmAuxilaryBackgroundInstance.getter + 32 (FBRealmAuxiliary.swift:23)
      45  Zerofy DEV                    	0x00000001024a8b5c closure realm/realm-swift#1 in closure realm/realm-swift#1 in static FBEmissionsAction.preloadEmissions(complete:) + 300 (FBEmissionsAction.swift:127)
      46  Zerofy DEV                    	0x00000001024ae9d4 specialized autoreleasepool<A>(invoking:) + 20 (FBEmissionsAction.swift:126)
      47  Zerofy DEV                    	0x00000001024ae9d4 closure realm/realm-swift#1 in static FBEmissionsAction.preloadEmissions(complete:) + 20 (<compiler-generated>:0)
      48  Zerofy DEV                    	0x00000001024ae9d4 partial apply for closure realm/realm-swift#1 in static FBEmissionsAction.preloadEmissions(complete:) + 44
      49  Zerofy DEV                    	0x00000001024aea10 thunk for @callee_guaranteed () -> () + 4 (<compiler-generated>:0)
      50  Zerofy DEV                    	0x00000001024aea10 partial apply for thunk for @callee_guaranteed () -> () + 20
      51  Zerofy DEV                    	0x00000001024a8d70 thunk for @escaping @callee_guaranteed () -> () + 20 (<compiler-generated>:0)
      52  libdispatch.dylib             	0x00000001803f3660 _dispatch_client_callout + 20 (object.m:560)
      53  libdispatch.dylib             	0x00000001804028b4 _dispatch_lane_barrier_sync_invoke_and_complete + 56 (queue.c:1016)
      54  Zerofy DEV                    	0x00000001024ae000 specialized static FBEmissionsAction.preloadEmissions(complete:) + 716 (FBEmissionsAction.swift:125)
      55  Zerofy DEV                    	0x000000010249c6c8 specialized static FBEmissionsAction.preloadEmissions(complete:) + 12 (<compiler-generated>:0)
      56  Zerofy DEV                    	0x000000010249c6c8 specialized ZerofyDatabaseMigrator.prepareData(label:complete:) + 2128
      57  Zerofy DEV                    	0x00000001023b3fb8 specialized ZerofyDatabaseMigrator.prepareData(label:complete:) + 12 (<compiler-generated>:0)
      58  Zerofy DEV                    	0x00000001023b3fb8 closure realm/realm-swift#1 in LoadingVC.setupView() + 64
      59  Zerofy DEV                    	0x000000010247f3a4 thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:0)
      60  libdispatch.dylib             	0x00000001803f1914 _dispatch_call_block_and_release + 32 (init.c:1517)
      61  libdispatch.dylib             	0x00000001803f3660 _dispatch_client_callout + 20 (object.m:560)
      62  libdispatch.dylib             	0x00000001803fade4 _dispatch_lane_serial_drain + 672 (inline_internal.h:2601)
      63  libdispatch.dylib             	0x00000001803fb958 _dispatch_lane_invoke + 392 (queue.c:3937)
      64  libdispatch.dylib             	0x00000001804061a8 _dispatch_workloop_worker_thread + 656 (queue.c:6727)
      65  libsystem_pthread.dylib       	0x00000001f130a0f4 _pthread_wqthread + 288 (pthread.c:2541)
      66  libsystem_pthread.dylib       	0x00000001f1309e94 start_wqthread + 8 (:-1)
      

      Can you reproduce the bug?

      Not yet

      Reproduction Steps

      Code sample:

      internal let RealmAuxilaryQueue = DispatchQueue(label: "realm-auxilary-background", qos: .background)

      func createFBRealmAuxilaryInstance(queue: DispatchQueue? = nil) -> Realm! {
              do {
                  let realm = try Realm(configuration: auxilaryConfiguration, queue: queue)
                  realm.autorefresh = true
                  return realm
              } catch let error as NSError {
                  logger.error("{REALM} ::: ERROR ::: \(error.localizedDescription)")
              }
          }
      }
      
      var auxilaryConfiguration: Realm.Configuration {
               var config = Realm.Configuration(shouldCompactOnLaunch: { totalBytes, usedBytes in
                  let oneHundredMB = 300 * 1_024 * 1_024
                  return (totalBytes > oneHundredMB) && (Double(usedBytes) / Double(totalBytes)) < 0.5
              })
              
              config.migrationBlock = { migration, oldSchemaVersion in
                  
              }
              config.schemaVersion = kRealmAuxiliaryVersion
              config.objectTypes = [EmissionsAuxiliary.self]
              if let fileURL = config.fileURL {
                  config.fileURL = fileURL.deletingLastPathComponent().appendingPathComponent("ZerofyAuxilary.realm")
              }
              
              return config
          }
      
      RealmAuxilaryQueue.sync {
                  autoreleasepool {
                      let realm = RealmAuxilaryBackgroundInstance
                      let objects = realm.objects(EmissionsAuxiliary.self)
                 }          
      }
      

      Version

      1.29

      What SDK flavour are you using?

      Local Database only

      Are you using encryption?

      No, not using encryption

      Platform OS and version(s)

      iOS 15.1.1 (19B81)

      Build environment

      Xcode 14.0.1
      Dependency manager and version: Xcode Package Manager

            Assignee:
            jorgen.edelbo@mongodb.com Jørgen Edelbo
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: