Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-1755

Realm with sync enabled CRASHES the whole app when "path" is specified

      How frequently does the bug occur?

      All the time

      Description

      I created a demo project that crashes after login immediatelly when in realm configuration we add path variable. It seems like unintended behaviour. When removing path no crash appears.

      https://github.com/boltss/realm-sync-demo demo project. That crashes when path is specified.

      In our case having 2 realms side by side is mandatory. And to separate them we need to specify path to one.

      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
      ERROR  [Error: Unable to open realm: Incompatible histories. Expected an empty or synced Realm, but found history type 2, top ref 344 Path: /Users/username/Library/Developer/CoreSimulator/Devices/A1DFCA63-1C6D-4666-AA79-024DB7533A92/data/Containers/Data/Application/67EA29FA-8BC7-470C-8B4D-950175BF4B50/Documents/sync.realm
      Exception backtrace:
      0   RealmSyncDemo                       0x00000001032b655c _ZN5realm21IncompatibleHistoriesC1ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_ + 84
      1   RealmSyncDemo                       0x00000001032b54f4 _ZN5realm2DB4openERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS_9DBOptionsE + 6728
      2   RealmSyncDemo                       0x00000001032b704c _ZN5realm2DB4openERNS_11ReplicationERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS_9DBOptionsE + 124
      3   RealmSyncDemo                       0x00000001032bd868 _ZN5realm2DB6createENSt3__110unique_ptrINS_11ReplicationENS1_14default_deleteIS3_EEEERKNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_9DBOptionsE + 156
      4   RealmSyncDemo                       0x00000001030bc618 _ZN5realm5_impl16RealmCoordinator7open_dbEv + 1212
      5   RealmSyncDemo                       0x00000001030bbe9c _ZN5realm5_impl16RealmCoordinator19create_sync_sessionEv + 36
      6   RealmSyncDemo                       0x00000001030be614 _ZN5realm5_impl16RealmCoordinator22get_synchronized_realmENS_11RealmConfigE + 80
      7   RealmSyncDemo                       0x000000010311a094 _ZN5realm5Realm22get_synchronized_realmENS_11RealmConfigE + 108
      8   RealmSyncDemo                       0x00000001030266ec _ZN5realm2js10RealmClassINS_3jsc5TypesEE16async_open_realmEPK15OpaqueJSContextP13OpaqueJSValueRNS0_9ArgumentsIS3_EERNS0_11ReturnValueIS3_EE + 772
      9   RealmSyncDemo                       0x000000010301be00 _ZN5realm2js4wrapIXadL_ZNS0_10RealmClassINS_3jsc5TypesEE16async_open_realmEPK15OpaqueJSContextP13OpaqueJSValueRNS0_9ArgumentsIS4_EERNS0_11ReturnValueIS4_EEEEEEPKS9_S8_SA_SA_mPKSI_PSI_ + 56
      10  JavaScriptCore                      0x000000019190e9c4 _ZN3JSCL22callJSCallbackFunctionEPNS_14JSGlobalObjectEPNS_9CallFrameE + 524
      11  ???                                 0x0000000134205664 0x0 + 5169501796
      12  JavaScriptCore                      0x0000000191882320 llint_entry + 151568
      13  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      14  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      15  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      16  JavaScriptCore                      0x0000000191883038 llint_entry + 154920
      17  JavaScriptCore                      0x0000000191882320 llint_entry + 151568
      18  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      19  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      20  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      21  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      22  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      23  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      24  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      25  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      26  JavaScriptCore                      0x0000000191882fa0 llint_entry + 154768
      27  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      28  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      29  JavaScriptCore                      0x0000000191882320 llint_entry + 151568
      30  JavaScriptCore                      0x0000000191882320 llint_entry + 151568
      31  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      32  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      33  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      34  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      35  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      36  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      37  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      38  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      39  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      40  JavaScriptCore                      0x0000000191882320 llint_entry + 151568
      41  JavaScriptCore                      0x0000000191882320 llint_entry + 151568
      42  JavaScriptCore                      0x00000001918835ec llint_entry + 156380
      43  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      44  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      45  JavaScriptCore                      0x00000001918835ec llint_entry + 156380
      46  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      47  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      48  JavaScriptCore                      0x0000000191882288 llint_entry + 151416
      49  JavaScriptCore                      0x000000019185d064 vmEntryToJavaScript + 264
      50  JavaScriptCore                      0x0000000192000e98 _ZN3JSC11Interpreter11executeCallEPNS_14JSGlobalObjectEPNS_8JSObjectERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 640
      51  JavaScriptCore                      0x0000000192329110 _ZN3JSC27boundThisNoArgsFunctionCallEPNS_14JSGlobalObjectEPNS_9CallFrameE + 744
      52  JavaScriptCore                      0x000000019185d210 vmEntryToNative + 280
      53  JavaScriptCore                      0x0000000192000ec0 _ZN3JSC11Interpreter11executeCallEPNS_14JSGlobalObjectEPNS_8JSObjectERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 680
      54  JavaScriptCore                      0x0000000191927b0c JSObjectCallAsFunction + 760
      55  RealmSyncDemo                       0x0000000102eb14b4 _ZN8facebook3jsc10JSCRuntime4callERKNS_3jsi8FunctionERKNS2_5ValueEPS7_m + 268
      56  RealmSyncDemo                       0x0000000102ec0820 _ZNK8facebook3jsi8Function4callERNS0_7RuntimeEPKNS0_5ValueEm + 100
      57  RealmSyncDemo                       0x0000000102ec075c _ZNK8facebook3jsi8Function4callERNS0_7RuntimeESt16initializer_listINS0_5ValueEE + 112
      58  RealmSyncDemo                       0x0000000102ee2800 _ZNK8facebook3jsi8Function4callIJRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESB_NS0_5ValueEEEESC_RNS0_7RuntimeEDpOT_ + 284
      59  RealmSyncDemo                       0x0000000102ee2674 _ZZN8facebook5react11JSIExecutor12callFunctionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_RKN5folly7dynamicEENK3$_5clEv + 140
      60  RealmSyncDemo                       0x0000000102ee25c8 _ZNSt3__1L8__invokeIRZN8facebook5react11JSIExecutor12callFunctionERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESB_RKN5folly7dynamicEE3$_5JEEEDTclscT_fp_spscT0_fp0_EEOSI_DpOSJ_ + 24
      61  RealmSyncDemo                       0x0000000102ee2580 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZN8facebook5react11JSIExecutor12callFunctionERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESD_RKN5folly7dynamicEE3$_5EEEvDpOT_ + 28
      62  RealmSyncDemo                       0x0000000102ee2558 _ZNSt3__110__function12__alloc_funcIZN8facebook5react11JSIExecutor12callFunctionERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESC_RKN5folly7dynamicEE3$_5NS8_ISH_EEFvvEEclEv + 28
      63  RealmSyncDemo                       0x0000000102ee12f8 _ZNSt3__110__function6__funcIZN8facebook5react11JSIExecutor12callFunctionERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESC_RKN5folly7dynamicEE3$_5NS8_ISH_EEFvvEEclEv + 28
      64  RealmSyncDemo                       0x0000000102f217e8 _ZNKSt3__110__function12__value_funcIFvvEEclEv + 60
      65  RealmSyncDemo                       0x0000000102f216f8 _ZNKSt3__18functionIFvvEEclEv + 24
      66  RealmSyncDemo                       0x0000000102c53620 _ZN8facebook5react11JSIExecutor21defaultTimeoutInvokerERKNSt3__18functionIFvvEEENS3_IFNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEvEEE + 24
      67  RealmSyncDemo                       0x0000000102c56584 _ZNSt3__1L8__invokeIRPFvRKNS_8functionIFvvEEENS1_IFNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEEJS5_SD_EEEDTclscT_fp_spscT0_fp0_EEOSH_DpOSI_ + 92
      68  RealmSyncDemo                       0x0000000102c564f8 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRPFvRKNS_8functionIFvvEEENS3_IFNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEES7_SF_EEEvDpOT_ + 72
      69  RealmSyncDemo                       0x0000000102c5647c _ZNSt3__110__function12__alloc_funcIPFvRKNS_8functionIFvvEEENS2_IFNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEENSA_ISG_EESF_EclES6_OSE_ + 72
      70  RealmSyncDemo                       0x0000000102c54ea0 _ZNSt3__110__function6__funcIPFvRKNS_8functionIFvvEEENS2_IFNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEENSA_ISG_EESF_EclES6_OSE_ + 72
      71  RealmSyncDemo                       0x0000000102ee0854 _ZNKSt3__110__function12__value_funcIFvRKNS_8functionIFvvEEENS2_IFNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEEEclES6_OSE_ + 104
      72  RealmSyncDemo                       0x0000000102ed0800 _ZNKSt3__18functionIFvRKNS0_IFvvEEENS0_IFNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEEEclES4_SC_ + 72
      73  RealmSyncDemo                       0x0000000102ed04b0 _ZN8facebook5react11JSIExecutor12callFunctionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_RKN5folly7dynamicE + 324
      74  RealmSyncDemo                       0x0000000102e97d88 _ZZN8facebook5react16NativeToJsBridge12callFunctionEONSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES9_ON5folly7dynamicEENK3$_2clEPNS0_10JSExecutorE + 636
      75  RealmSyncDemo                       0x0000000102e97aec _ZNSt3__1L8__invokeIRZN8facebook5react16NativeToJsBridge12callFunctionEONS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESA_ON5folly7dynamicEE3$_2JPNS2_10JSExecutorEEEEDTclscT_fp_spscT0_fp0_EEOSI_DpOSJ_ + 36
      76  RealmSyncDemo                       0x0000000102e97a98 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZN8facebook5react16NativeToJsBridge12callFunctionEONS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESC_ON5folly7dynamicEE3$_2PNS4_10JSExecutorEEEEvDpOT_ + 52
      77  RealmSyncDemo                       0x0000000102e97a58 _ZNSt3__110__function12__alloc_funcIZN8facebook5react16NativeToJsBridge12callFunctionEONS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESB_ON5folly7dynamicEE3$_2NS8_ISF_EEFvPNS3_10JSExecutorEEEclEOSI_ + 52
      78  RealmSyncDemo                       0x0000000102e964fc _ZNSt3__110__function6__funcIZN8facebook5react16NativeToJsBridge12callFunctionEONS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESB_ON5folly7dynamicEE3$_2NS8_ISF_EEFvPNS3_10JSExecutorEEEclEOSI_ + 52
      79  RealmSyncDemo                       0x0000000102ea3fb8 _ZNKSt3__110__function12__value_funcIFvPN8facebook5react10JSExecutorEEEclEOS5_ + 84
      80  RealmSyncDemo                       0x0000000102ea3f30 _ZNKSt3__18functionIFvPN8facebook5react10JSExecutorEEEclES4_ + 48
      81  RealmSyncDemo                       0x0000000102ea3ef0 _ZZN8facebook5react16NativeToJsBridge18runOnExecutorQueueENSt3__18functionIFvPNS0_10JSExecutorEEEEENK3$_8clEv + 92
      82  RealmSyncDemo                       0x0000000102ea3e74 _ZNSt3__1L8__invokeIRZN8facebook5react16NativeToJsBridge18runOnExecutorQueueENS_8functionIFvPNS2_10JSExecutorEEEEE3$_8JEEEDTclscT_fp_spscT0_fp0_EEOSB_DpOSC_ + 24
      83  RealmSyncDemo                       0x0000000102ea3e2c _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZN8facebook5react16NativeToJsBridge18runOnExecutorQueueENS_8functionIFvPNS4_10JSExecutorEEEEE3$_8EEEvDpOT_ + 28
      84  RealmSyncDemo                       0x0000000102ea3e04 _ZNSt3__110__function12__alloc_funcIZN8facebook5react16NativeToJsBridge18runOnExecutorQueueENS_8functionIFvPNS3_10JSExecutorEEEEE3$_8NS_9allocatorISA_EEFvvEEclEv + 28
      85  RealmSyncDemo                       0x0000000102ea2764 _ZNSt3__110__function6__funcIZN8facebook5react16NativeToJsBridge18runOnExecutorQueueENS_8functionIFvPNS3_10JSExecutorEEEEE3$_8NS_9allocatorISA_EEFvvEEclEv + 28
      86  RealmSyncDemo                       0x0000000102f217e8 _ZNKSt3__110__function12__value_funcIFvvEEclEv + 60
      87  RealmSyncDemo                       0x0000000102f216f8 _ZNKSt3__18functionIFvvEEclEv + 24
      88  RealmSyncDemo                       0x0000000102ca8f70 _ZN8facebook5react17tryAndReturnErrorERKNSt3__18functionIFvvEEE + 24
      89  RealmSyncDemo                       0x0000000102cd64a8 _ZN8facebook5react16RCTMessageThread7tryFuncERKNSt3__18functionIFvvEEE + 36
      90  RealmSyncDemo                       0x0000000102cdc200 _ZZN8facebook5react16RCTMessageThread10runOnQueueEONSt3__18functionIFvvEEEENK3$_1clEv + 80
      91  RealmSyncDemo                       0x0000000102cdc190 _ZNSt3__1L8__invokeIRZN8facebook5react16RCTMessageThread10runOnQueueEONS_8functionIFvvEEEE3$_1JEEEDTclscT_fp_spscT0_fp0_EEOSA_DpOSB_ + 24
      92  RealmSyncDemo                       0x0000000102cdc148 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callIJRZN8facebook5react16RCTMessageThread10runOnQueueEONS_8functionIFvvEEEE3$_1EEEvDpOT_ + 28
      93  RealmSyncDemo                       0x0000000102cdc120 _ZNSt3__110__function12__alloc_funcIZN8facebook5react16RCTMessageThread10runOnQueueEONS_8functionIFvvEEEE3$_1NS_9allocatorIS9_EES6_EclEv + 28
      94  RealmSyncDemo                       0x0000000102cdab84 _ZNSt3__110__function6__funcIZN8facebook5react16RCTMessageThread10runOnQueueEONS_8functionIFvvEEEE3$_1NS_9allocatorIS9_EES6_EclEv + 28
      95  RealmSyncDemo                       0x0000000102f217e8 _ZNKSt3__110__function12__value_funcIFvvEEclEv + 60
      96  RealmSyncDemo                       0x0000000102f216f8 _ZNKSt3__18functionIFvvEEclEv + 24
      97  RealmSyncDemo                       0x0000000102cd6204 ___ZN8facebook5react16RCTMessageThread8runAsyncENSt3__18functionIFvvEEE_block_invoke + 48
      98  CoreFoundation                      0x0000000180361f94 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
      99  CoreFoundation                      0x0000000180361268 __CFRunLoopDoBlocks + 408
      100 CoreFoundation                      0x000000018035ba04 __CFRunLoopRun + 724
      101 CoreFoundation                      0x000000018035b218 CFRunLoopRunSpecific + 572
      102 RealmSyncDemo                       0x0000000102c7a8c8 +[RCTCxxBridge runRunLoop] + 764
      103 Foundation                          0x0000000180851578 __NSThread__start__ + 792
      104 libsystem_pthread.dylib             0x00000001cc0b16c8 _pthread_start + 116
      105 libsystem_pthread.dylib             0x00000001cc0ac910 thread_start + 8.]
      

      Can you reproduce the bug?

      Yes, always

      Reproduction Steps

      open App.tsx and either removing or adding path makes it run or crash.

      const RealmContext = createRealmContext({
      	schema: [],
      	// This line crashes the app with sync.
      	path: 'sync.realm',
      });
      

      Crash happens after realm.logIn()

      Version

      10.19.1

      What SDK flavour are you using?

      Atlas App Services (auth, functions, etc.)

      Are you using encryption?

      No, not using encryption

      Platform OS and version(s)

      iOS 15.5

      Build environment

      System:
      OS: macOS 12.4
      CPU: (10) arm64 Apple M1 Pro
      Memory: 105.23 MB / 16.00 GB
      Shell: 5.8.1 - /bin/zsh
      Binaries:
      Node: 17.9.0 - ~/.volta/tools/image/node/17.9.0/bin/node
      Yarn: 1.22.18 - ~/.volta/tools/image/yarn/1.22.18/bin/yarn
      npm: 8.5.5 - ~/.volta/tools/image/node/17.9.0/bin/npm
      Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
      Managers:
      CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
      SDKs:
      iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
      Android SDK:
      Android NDK: 23.0.7344513-beta4
      IDEs:
      Android Studio: Chipmunk 2021.2.1 Patch 1 Chipmunk 2021.2.1 Patch 1
      Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
      Languages:
      Java: 18.0.1 - /Users/username/.jenv/shims/javac
      npmPackages:
      @react-native-community/cli: Not Found
      react: 17.0.2 => 17.0.2
      react-native: 0.68.2 => 0.68.2
      react-native-macos: Not Found
      npmGlobalPackages:
      react-native: Not Found

      Cocoapods version

      1.11.3

            Assignee:
            tom.duncalf@mongodb.com Tom Duncalf (Inactive)
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: