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

Unable to open encrypted realm file after failed upgrade to Realm 5.3.5

      <!---

      Questions: If you have questions about HOW TO USE Realm, ask on
      StackOverflow,
      or in our Swift Forum or Obj-C Forum.

      Feature Request: Just fill in the first two sections below.

      Bugs: To help you as fast as possible with an issue please describe your issue
      and the steps you have taken to reproduce it in as many details as possible.

      -->

      Goals

      <!--- What do you want to achieve? -->
      Open the encrypted realm file to recover data from it after a failed upgrade

      Expected Results

      <!--- What did you expect to happen? -->
      The file to open in the previous realm version

      Actual Results

      <!--- What happened instead?
      e.g. the stack trace of a crash
      -->

      The app was using Realm 4.4.1 and it is updated to 5.3.5. The upgrade failed with the following error:

      Opening Realm files of format version 0 is not supported by this version of Realm
      

      In order to retrieve the data inside the realm file, the Realm version was reverted to 4.4.1. However, opening the realm file failed with the following error:

      Unable to open a realm at path '/var/mobile/Containers/Data/Application/F5755876-C723-4443-A145-F922D90C6353/Documents/realm.realm': Top ref outside file (size = 33685504). top_ref[0]: 5C12650, top_ref[1]: 5C6F3F0, mnemonic: 54 2D 44 42, fmt[0]: 10, fmt[1]: 10, flags: 1 Path:Exception backtrace:
      0   Realm                               0x0000000104081d1c _ZN5realm15InvalidDatabaseC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_ + 60
      1   Realm                               0x0000000103fd1424 _ZN5realm9SlabAlloc22throw_header_exceptionENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS0_6HeaderERKS7_ + 132
      2   Realm                               0x0000000103fd0d68 _ZN5realm9SlabAlloc15validate_bufferEPKcmRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE + 664
      3   Realm                               0x0000000103fcfe1c _ZN5realm9SlabAlloc11attach_fileERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS0_6ConfigE + 1960
      4   Realm                               0x000000010407bd6c _ZN5realm11SharedGroup7do_openERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbbNS_18SharedGroupOptionsE + 3088
      5   Realm                               0x0000000103f99084 _ZN5realm11SharedGroup4openERNS_11ReplicationENS_18SharedGroupOptionsE + 180
      6   Realm                               0x0000000103f98d18 _ZN5realm11SharedGroupC2ERNS_11ReplicationENS_18SharedGroupOptionsE + 764
      7   Realm                               0x0000000103f92334 _ZN5realm5Realm16open_with_configERKNS0_6ConfigERNSt3__110unique_ptrINS_11ReplicationENS4_14default_deleteIS6_EEEERNS5_INS_11SharedGroupENS7_ISB_EEEERNS5_INS_5GroupENS7_ISF_EEEEPS0_ + 996
      8   Realm                               0x0000000103f91d38 _ZN5realm5RealmC2ENS0_6ConfigENSt3__110shared_ptrINS_5_impl16RealmCoordinatorEEE + 204
      9   Realm                               0x0000000103ec5988 _ZZN5realm5Realm17make_shared_realmENS0_6ConfigENSt3__110shared_ptrINS_5_impl16RealmCoordinatorEEEEN19make_shared_enablerC2ES1_S6_ + 80
      10  Realm                               0x0000000103ec57a8 _ZNSt3__110shared_ptrIZN5realm5Realm17make_shared_realmENS2_6ConfigENS0_INS1_5_impl16RealmCoordinatorEEEE19make_shared_enablerE11make_sharedIJS3_S6_EEES8_DpOT_ + 132
      11  Realm                               0x0000000103ec0280 _ZN5realm5_impl16RealmCoordinator12do_get_realmENS_5Realm6ConfigERNSt3__110shared_ptrIS2_EERNS4_11unique_lockINS4_5mutexEEEb + 228
      12  Realm                               0x0000000103ec00ec _ZN5realm5_impl16RealmCoordinator9get_realmENS_5Realm6ConfigE + 296
      13  Realm                               0x0000000103f93d1c _ZN5realm5Realm16get_shared_realmENS0_6ConfigE + 108
      14  Realm                               0x0000000103f6332c +[RLMRealm realmWithConfiguration:error:] + 512
      15  RealmSwift                          0x0000000104703f9c $sSo8RLMRealmC13configurationABSo0A13ConfigurationC_tKcfCTO + 148
      16  RealmSwift                          0x0000000104703e00 $s10RealmSwift0A0VACyKcfC + 96
      17  AppNameModels                       0x0000000102924e28 $s13AppNameModels17createRealmHelper33_8ECD61DB9B26DAE8DC83FE19B0C5AAD0LL0D5Swift0D0VyKF + 1328
      18  AppNameModels                       0x00000001029248a0 $s13AppNameModels10checkRealmyyKF + 20
      19  AppName                             0x0000000100c33f38 $s7AppName19ConfigurationHelperV10setupRealm10PromiseKit0F0CyytGyFZyyt_tKcfU0_ + 716
      20  AppName                             0x0000000100a7cbe8 $ss5Error_pIegzo_ytsAA_pIegnzo_TR + 24
      21  AppName                             0x0000000100c36454 $ss5Error_pIegzo_ytsAA_pIegnzo_TRTA.10 + 24
      22  PromiseKit                          0x0000000103d7a404 $s10PromiseKit8ThenablePAAE4done2on5flags_AA0A0CyytGSo17OS_dispatch_queueCSg_8Dispatch0J13WorkItemFlagsVSgy1TQzKctFyAA6ResultOyARGcfU_yycfU_ + 192
      23  PromiseKit                          0x0000000103d4a868 $sIeg_IeyB_TR + 56
      24  libdispatch.dylib                   0x0000000105212338 _dispatch_call_block_and_release + 24
      25  libdispatch.dylib                   0x0000000105213730 _dispatch_client_callout + 16
      26  libdispatch.dylib                   0x0000000105224ec8 _dispatch_root_queue_drain + 716
      27  libdispatch.dylib                   0x0000000105225698 _dispatch_worker_thread2 + 152
      28  libsystem_pthread.dylib             0x00000001b7e2db38 _pthread_wqthread + 212
      29  libsystem_pthread.dylib             0x00000001b7e30740 start_wqthread + 8.
      

      Steps for others to Reproduce

      <!--- What are steps OTHERS can follow to reproduce this issue? -->
      Not sure how to reproduce exactly as in most cases the migration succeed. And some of the retrieved realms were successfully opened.

      <!---

      Code Sample

      Provide a code sample or test case that highlights the issue.
      If relevant, include your model definitions.
      For larger code samples, links to external gists/repositories are preferred.
      Alternatively share confidentially via mail to help@realm.io.
      Full Xcode projects that we can compile ourselves are ideal!
      -->

      Version of Realm and Tooling

      <!---
      In the CONTRIBUTING guidelines, you will find a script,
      which will help determining some of these versions.
      -->

      Realm framework version: 4.4.1 / 5.5.3

      Realm Object Server version: NA

      Xcode version: 11.6

      iOS/OSX version: iOS 13.6

      Dependency manager + version: cocoapods 1.9.3

            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: