Uploaded image for project: 'Realm Cocoa SDK'
  1. Realm Cocoa SDK
  2. RCOCOA-751

Assertion failed: ref != 0 with (ref, get_file_path_for_assertions())

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

      Realm is crashing, consequently taking my app with it, during initialization when attempting to open the Realm database with the following error.

      This began happening to some of our users when my app was upgraded to use Realm v5.0.3 and remains with additional update to v5.2.0. App has been working fine when it was using v4.x.x of Realm/RealmSwift. While it doesn't happen to everyone, once it happens to a user, Realm continues to crash without relief.

      Goals

      Goals: Don't crash

      Expected Results

      Realm will open the default.realm database my app uses so the app can run.

      Actual Results

      From the Output Console (not in debug):
      /Users/realm/workspace/realm_realm-core_release_6.0.8/src/realm/alloc_slab.cpp:522: [realm-core-6.0.8] Assertion failed: ref != 0 with (ref, get_file_path_for_assertions()) = [0, "/var/mobile/Containers/Data/Application/963F13C3-0655-4E7D-8729-08A375989861/Documents/default.realm"]
      0 Realm 0x0000000101b72e04 _ZN5realm4util9terminateEPKcS2_l + 480
      1 Realm 0x0000000101b732a0 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 388
      2 Realm 0x0000000101a80b4c _ZNK5realm9SlabAlloc28get_file_path_for_assertionsEv + 0
      3 Realm 0x0000000101a824c4 _ZN5realm9SlabAlloc7do_freeEmPc + 1464
      4 Realm 0x0000000101aadd54 _ZNK5realm5Group17get_to_dot_parentEm + 1512
      5 Realm 0x0000000101a1ab20 ZN5realm5Array9get_threeEPKcmRmS3_S3

      • 560
        6 Realm 0x0000000101b334b0 _Z<…>

      Xcode Debug Output window:
      /Users/realm/workspace/realm_realm-core_release_6.0.8/src/realm/alloc_slab.cpp:522: [realm-core-6.0.8] Assertion failed: ref != 0 with (ref, get_file_path_for_assertions()) = [0, "/var/mobile/Containers/Data/Application/557C397B-5F5F-4CAB-80C4-412DD916F9FC/Documents/default.realm"]
      0 Realm 0x0000000101bc7f14 ZN5realm4utilL18terminate_internalERNSt3_118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
      1 Realm 0x0000000101bc83b0 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 388
      2 Realm 0x0000000101ad33f0 _ZNK5realm9SlabAlloc28get_file_path_for_assertionsEv + 0
      3 Realm 0x0000000101ad4d58 _ZN5realm9SlabAlloc7do_freeEmPc + 1464
      4 Realm 0x0000000101b0015c _ZN5realm16WrappedAllocator7do_freeEmPc + 24
      5 Realm 0x0000000101ad9ea4 _ZN5realm5Array12destroy_deepENS_6MemRefERNS_9AllocatorE + 60
      6 Realm 0x0000000101b88264 _ZN5realm5Table15migrate_indexesENS_6ColKeyENS_4util11FunctionRefIFvvEEE + 588
      7 Realm 0x0000000101afa508 _ZN5realm11Transaction19upgrade_file_formatEi + 1224
      8 Realm 0x0000000101b0430c _ZN5realm2DB19upgrade_file_formatEbiii + 292
      9 Realm 0x0000000101b01fb8 ZN5realm2DB7do_openERKNSt3_112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbbNS_9DBOptionsE + 3516
      10 Realm 0x0000000101b0492c _ZN5realm2DB4openERNS_11ReplicationENS_9DBOptionsE + 244
      11 Realm 0x0000000101b090e4 _ZN5realm2DB6createERNS_11ReplicationENS_9DBOptionsE + 392
      12 Realm 0x00000001016ba44c _ZN5realm5_impl16RealmCoordinator7open_dbEv + 972
      13 Realm 0x00000001016b96a0 ZN5realm5_impl16RealmCoordinator12do_get_realmENS_5Realm6ConfigERNSt3_110shared_ptrIS2_EENS_4util8OptionalINS_9VersionIDEEERNS8_17CheckedUniqueLockE + 72
      14 Realm 0x00000001016b9538 _ZN5realm5_impl16RealmCoordinator9get_realmENS_5Realm6ConfigENS_4util8OptionalINS_9VersionIDEEE + 268
      15 Realm 0x000000010190b55c _ZN5realm5Realm16get_shared_realmENS0_6ConfigE + 152
      16 Realm 0x0000000101855da8 [RLMRealm realmWithConfiguration:queue:error:] 1760
      17 RealmSwift 0x0000000102c53548 $sSo8RLMRealmC13configuration5queueABSo0A13ConfigurationC_So012OS_dispatch_C0CSgtKcfCTO + 156
      18 RealmSwift 0x0000000102c8a9f0 $s10RealmSwift0A0V5queueACSo012OS_dispatch_C0CSg_tKcfC + 140
      19 sports-audio-dj 0x0000000100dd2414 $s15sports_audio_dj11AppDelegateC24handleRealmConfigChangesyyF + 560
      20 sports-audio-dj 0x0000000100dd0e20 $s15sports_audio_dj11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0l6LaunchK3KeyaypGSgtF + 72
      21 sports-audio-dj 0x0000000100dd0f90 $s15sports_audio_dj11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0l6LaunchK3KeyaypGSgtFTo + 232
      22 UIKitCore 0x00000001913dfc74 BD57BD6E-12B4-3F92-85CA-754932DA499D + 10636404
      23 UIKitCore 0x00000001913e1a00 BD57BD6E-12B4-3F92-85CA-754932DA499D + 10643968
      24 UIKitCore 0x00000001913e729c BD57BD6E-12B4-3F92-85CA-754932DA499D + 10666652
      25 UIKitCore 0x0000000190b8bb70 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1903472
      26 UIKitCore 0x000000019103c2dc _UIScenePerformActionsWithLifecycleActionMask + 100
      27 UIKitCore 0x0000000190b8c654 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1906260
      28 UIKitCore 0x0000000190b8c0a8 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1904808
      29 UIKitCore 0x0000000190b8c480 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1905792
      30 UIKitCore 0x0000000190b8bd40 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1903936
      31 UIKitCore 0x0000000190b901dc BD57BD6E-12B4-3F92-85CA-754932DA499D + 1921500
      32 UIKitCore 0x0000000190f603a0 BD57BD6E-12B4-3F92-85CA-754932DA499D + 5919648
      33 UIKitCore 0x0000000191055720 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 244
      34 UIKitCore 0x0000000190b8ff38 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1920824
      35 UIKitCore 0x000000019105561c _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 100
      36 UIKitCore 0x0000000190b8fda0 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1920416
      37 UIKitCore 0x00000001909fff74 BD57BD6E-12B4-3F92-85CA-754932DA499D + 282484
      38 UIKitCore 0x00000001909feb14 BD57BD6E-12B4-3F92-85CA-754932DA499D + 277268
      39 UIKitCore 0x00000001909ffcac BD57BD6E-12B4-3F92-85CA-754932DA499D + 281772
      40 UIKitCore 0x00000001913e54e8 BD57BD6E-12B4-3F92-85CA-754932DA499D + 10659048
      41 UIKitCore 0x0000000190f8568c BD57BD6E-12B4-3F92-85CA-754932DA499D + 6071948
      42 FrontBoardServices 0x00000001924b961c 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 50716
      43 FrontBoardServices 0x00000001924de194 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 201108
      44 FrontBoardServices 0x00000001924c3bfc 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 93180
      45 FrontBoardServices 0x00000001924dde50 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 200272
      46 libdispatch.dylib 0x0000000102e13730 _dispatch_client_callout + 16
      47 libdispatch.dylib 0x0000000102e16bb0 _dispatch_block_invoke_direct + 232
      48 FrontBoardServices 0x0000000192502850 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 350288
      49 FrontBoardServices 0x000000019250251c 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 349468
      50 FrontBoardServices 0x0000000192502a44 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 350788
      51 CoreFoundation 0x000000018d2c0c18 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 691224
      52 CoreFoundation 0x000000018d2c0b70 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 691056
      53 CoreFoundation 0x000000018d2c02f8 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 688888
      54 CoreFoundation 0x000000018d2bb328 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 668456
      55 CoreFoundation 0x000000018d2bace8 CFRunLoopRunSpecific + 424
      56 GraphicsServices 0x000000019740538c GSEventRunModal + 160
      57 UIKitCore 0x00000001913e9444 UIApplicationMain + 1932
      58 sports-audio-dj 0x0000000100dd368c main + 80
      59 libdyld.dylib 0x000000018d1428f0 3D6D64B4-CB2B-3CC4-A7E9-02774DF7AE74 + 6384!!! IMPORTANT: Please send this log and info about Realm SDK version and other relevant reproduction info to help@realm.io.2020-07-11 13:51:18.529024-0600 sports-audio-dj[328:12455] /Users/realm/workspace/realm_realm-core_release_6.0.8/src/realm/alloc_slab.cpp:522: [realm-core-6.0.8] Assertion failed: ref != 0 with (ref, get_file_path_for_assertions()) = [0, "/var/mobile/Containers/Data/Application/557C397B-5F5F-4CAB-80C4-412DD916F9FC/Documents/default.realm"]
      0 Realm 0x0000000101bc7f14 ZN5realm4utilL18terminate_internalERNSt3_118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
      1 Realm 0x0000000101bc83b0 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 388
      2 Realm 0x0000000101ad33f0 _ZNK5realm9SlabAlloc28get_file_path_for_assertionsEv + 0
      3 Realm 0x0000000101ad4d58 _ZN5realm9SlabAlloc7do_freeEmPc + 1464
      4 Realm 0x0000000101b0015c _ZN5realm16WrappedAllocator7do_freeEmPc + 24
      5 Realm 0x0000000101ad9ea4 _ZN5realm5Array12destroy_deepENS_6MemRefERNS_9AllocatorE + 60
      6 Realm 0x0000000101b88264 _ZN5realm5Table15migrate_indexesENS_6ColKeyENS_4util11FunctionRefIFvvEEE + 588
      7 Realm 0x0000000101afa508 _ZN5realm11Transaction19upgrade_file_formatEi + 1224
      8 Realm 0x0000000101b0430c _ZN5realm2DB19upgrade_file_formatEbiii + 292
      9 Realm 0x0000000101b01fb8 ZN5realm2DB7do_openERKNSt3_112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbbNS_9DBOptionsE + 3516
      10 Realm 0x0000000101b0492c _ZN5realm2DB4openERNS_11ReplicationENS_9DBOptionsE + 244
      11 Realm 0x0000000101b090e4 _ZN5realm2DB6createERNS_11ReplicationENS_9DBOptionsE + 392
      12 Realm 0x00000001016ba44c _ZN5realm5_impl16RealmCoordinator7open_dbEv + 972
      13 Realm 0x00000001016b96a0 ZN5realm5_impl16RealmCoordinator12do_get_realmENS_5Realm6ConfigERNSt3_110shared_ptrIS2_EENS_4util8OptionalINS_9VersionIDEEERNS8_17CheckedUniqueLockE + 72
      14 Realm 0x00000001016b9538 _ZN5realm5_impl16RealmCoordinator9get_realmENS_5Realm6ConfigENS_4util8OptionalINS_9VersionIDEEE + 268
      15 Realm 0x000000010190b55c _ZN5realm5Realm16get_shared_realmENS0_6ConfigE + 152
      16 Realm 0x0000000101855da8 [RLMRealm realmWithConfiguration:queue:error:] 1760
      17 RealmSwift 0x0000000102c53548 $sSo8RLMRealmC13configuration5queueABSo0A13ConfigurationC_So012OS_dispatch_C0CSgtKcfCTO + 156
      18 RealmSwift 0x0000000102c8a9f0 $s10RealmSwift0A0V5queueACSo012OS_dispatch_C0CSg_tKcfC + 140
      19 sports-audio-dj 0x0000000100dd2414 $s15sports_audio_dj11AppDelegateC24handleRealmConfigChangesyyF + 560
      20 sports-audio-dj 0x0000000100dd0e20 $s15sports_audio_dj11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0l6LaunchK3KeyaypGSgtF + 72
      21 sports-audio-dj 0x0000000100dd0f90 $s15sports_audio_dj11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0l6LaunchK3KeyaypGSgtFTo + 232
      22 UIKitCore 0x00000001913dfc74 BD57BD6E-12B4-3F92-85CA-754932DA499D + 10636404
      23 UIKitCore 0x00000001913e1a00 BD57BD6E-12B4-3F92-85CA-754932DA499D + 10643968
      24 UIKitCore 0x00000001913e729c BD57BD6E-12B4-3F92-85CA-754932DA499D + 10666652
      25 UIKitCore 0x0000000190b8bb70 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1903472
      26 UIKitCore 0x000000019103c2dc _UIScenePerformActionsWithLifecycleActionMask + 100
      27 UIKitCore 0x0000000190b8c654 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1906260
      28 UIKitCore 0x0000000190b8c0a8 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1904808
      29 UIKitCore 0x0000000190b8c480 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1905792
      30 UIKitCore 0x0000000190b8bd40 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1903936
      31 UIKitCore 0x0000000190b901dc BD57BD6E-12B4-3F92-85CA-754932DA499D + 1921500
      32 UIKitCore 0x0000000190f603a0 BD57BD6E-12B4-3F92-85CA-754932DA499D + 5919648
      33 UIKitCore 0x0000000191055720 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 244
      34 UIKitCore 0x0000000190b8ff38 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1920824
      35 UIKitCore 0x000000019105561c _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 100
      36 UIKitCore 0x0000000190b8fda0 BD57BD6E-12B4-3F92-85CA-754932DA499D + 1920416
      37 UIKitCore 0x00000001909fff74 BD57BD6E-12B4-3F92-85CA-754932DA499D + 282484
      38 UIKitCore 0x00000001909feb14 BD57BD6E-12B4-3F92-85CA-754932DA499D + 277268
      39 UIKitCore 0x00000001909ffcac BD57BD6E-12B4-3F92-85CA-754932DA499D + 281772
      40 UIKitCore 0x00000001913e54e8 BD57BD6E-12B4-3F92-85CA-754932DA499D + 10659048
      41 UIKitCore 0x0000000190f8568c BD57BD6E-12B4-3F92-85CA-754932DA499D + 6071948
      42 FrontBoardServices 0x00000001924b961c 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 50716
      43 FrontBoardServices 0x00000001924de194 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 201108
      44 FrontBoardServices 0x00000001924c3bfc 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 93180
      45 FrontBoardServices 0x00000001924dde50 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 200272
      46 libdispatch.dylib 0x0000000102e13730 _dispatch_client_callout + 16
      47 libdispatch.dylib 0x0000000102e16bb0 _dispatch_block_invoke_direct + 232
      48 FrontBoardServices 0x0000000192502850 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 350288
      49 FrontBoardServices 0x000000019250251c 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 349468
      50 FrontBoardServices 0x0000000192502a44 6A942CC3-4B73-3477-AF9F-95C8EDCB8C85 + 350788
      51 CoreFoundation 0x000000018d2c0c18 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 691224
      52 CoreFoundation 0x000000018d2c0b70 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 691056
      53 CoreFoundation 0x000000018d2c02f8 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 688888
      54 CoreFoundation 0x000000018d2bb328 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 668456
      55 CoreFoundation 0x000000018d2bace8 CFRunLoopRunSpecific + 424
      56 GraphicsServices 0x000000019740538c GSEventRunModal + 160
      57 UIKitCore 0x00000001913e9444 UIApplicationMain + 1932
      58 sports-audio-dj 0x0000000100dd368c main + 80
      59 libdyld.dylib 0x000000018d1428f0 3D6D64B4-CB2B-3CC4-A7E9-02774DF7AE74 + 6384!!! IMPORTANT: Please send this log and info about Realm SDK version and other relevant reproduction info to help@realm.io.
      (lldb)

      Steps to Reproduce

      I start my iOS app and during Realm initialization Realm errors out.

      Code Sample

      Here is the Realm Code where the error is happening following my call to
      bool server_synchronization_mode = m_config.sync_config || m_config.force_sync_history;
      try {
      if (m_config.immutable()) {
      if (m_config.realm_data.is_null())

      { m_read_only_group = std::make_shared<Group>(m_config.path, m_config.encryption_key.data(), Group::mode_ReadOnly); }

      else

      { // Create in-memory read-only realm from existing buffer (without taking ownership of the buffer) m_read_only_group = std::make_unique<Group>(m_config.realm_data, false); }

      return;
      }

          if (server_synchronization_mode) {
      

      #if REALM_ENABLE_SYNC
      m_history = sync::make_client_replication(m_config.path);
      #else
      REALM_TERMINATE("Realm was not built with sync enabled");
      #endif
      }
      else

      { m_history = make_in_realm_history(m_config.path); }
          DBOptions options;
          options.durability = m_config.in_memory
                             ? DBOptions::Durability::MemOnly
                             : DBOptions::Durability::Full;
      
          if (!m_config.fifo_files_fallback_path.empty()) {
              options.temp_dir = util::normalize_dir(m_config.fifo_files_fallback_path);
          }
          options.encryption_key = m_config.encryption_key.data();
          options.allow_file_format_upgrade = !m_config.disable_format_upgrade
                                           && m_config.schema_mode != SchemaMode::ResetFile;
          m_db = DB::create(*m_history, options);  *** ERROR BREAK LINE ***
      }
      

      Version of Realm and Tooling

      Realm framework version: Realm/RealmSwift v5.2.0

      Realm Object Server version: N/A

      Xcode version: 11.5

      iOS/OSX version: 13.5.1

      Dependency manager + version: ?

            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: