realm / realm-object-server

Tracking of issues related to the Realm Object Server and other general issues not related to the specific SDK's
https://realm.io
293 stars 42 forks source link

Migrating Data from ROS 1 to ROS 2 #338

Closed Jonsapps closed 6 years ago

Jonsapps commented 6 years ago

Goals

I am trying to upgrade my instance of ROS 1.8.1 to ROS 2.6.2 and migrate my existing data.

Expected Results

Run the ros migrate command and start the new ROS instance and the data should be converted.

I have successful setup and have running an instance of ROS 2.6.2 When I run the ros migrate command the data is copied to the data folder on the new ROS instance but when I start the instance (ros start) it begins converting the data and I encounter the following error

info: Loaded feature token capabilities=[Sync], expires=Wed Apr 19 2017 15:15:29 GMT+0100 (BST)
info: Realm Object Server version 2.6.0 is starting
info: [sync] Migration required
info: [sync] Found 1 Realm files in /home/jon/MigratedData/sync/user_data
info: [sync] Migrating common/SharedRealm.realm (1/1)
fatal: [sync] Encountered an error starting up: realm::LogicError: Row index out of range
Error starting Realm Object Server: Row index out of range

I have then tried copying the data from the old realm to the new one which completes but when I do a refresh install the data fails to sync and ROS crashes with the following

Realm Object Server was started on 0.0.0.0:9081
Killed
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! my-ros-app@1.0.0 start: `node src/index.js`
npm ERR! Exit status 137
npm ERR! 
npm ERR! Failed at the my-ros-app@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jon/.npm/_logs/2018-01-22T10_25_01_117Z-debug.log

The log is included below.

  1. Run ros migrate --from /srv/old-root --to /srv/new-root/ --copyrealms
  2. Copy the keys using cp /srv/keys/auth.{key,pub} /srv/new-ros/keys/
  3. Start the new realm instance using ros start
  4. Data starts to migrate but then fails.

Version of Realm and Tooling

Logs

0 info it worked if it ends with ok
1 verbose cli [ '/home/jon/.nvm/versions/node/v8.9.4/bin/node',
1 verbose cli   '/home/jon/.nvm/versions/node/v8.9.4/bin/npm',
1 verbose cli   'start' ]
2 info using npm@5.6.0
3 info using node@v8.9.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle my-ros-app@1.0.0~prestart: my-ros-app@1.0.0
6 info lifecycle my-ros-app@1.0.0~start: my-ros-app@1.0.0
7 verbose lifecycle my-ros-app@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle my-ros-app@1.0.0~start: PATH: /home/jon/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/jon/TheHUBServerV2/node_modules/.bin:/home/jon/bin:/home/jon/.local/bin:/home/jon/.nvm/versions/node/v8.9.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle my-ros-app@1.0.0~start: CWD: /home/jon/TheHUBServerV2
10 silly lifecycle my-ros-app@1.0.0~start: Args: [ '-c', 'node src/index.js' ]
11 silly lifecycle my-ros-app@1.0.0~start: Returned: code: 137  signal: null
12 info lifecycle my-ros-app@1.0.0~start: Failed to exec start script
13 verbose stack Error: my-ros-app@1.0.0 start: `node src/index.js`
13 verbose stack Exit status 137
13 verbose stack     at EventEmitter.<anonymous> (/home/jon/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/home/jon/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid my-ros-app@1.0.0
15 verbose cwd /home/jon/TheHUBServerV2
16 verbose Linux 4.4.0-62-generic
17 verbose argv "/home/jon/.nvm/versions/node/v8.9.4/bin/node" "/home/jon/.nvm/versions/node/v8.9.4/bin/npm" "start"
18 verbose node v8.9.4
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 137
22 error my-ros-app@1.0.0 start: `node src/index.js`
22 error Exit status 137
23 error Failed at the my-ros-app@1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 137, true ]
Jonsapps commented 6 years ago

It appears that after doing a manual copy of the data from ROS V1 to V2, Realm studio will connect and display the data but any client (we've tried Swift and JS) cause ROS to crash when they initially connect and start the sync process.

Jonsapps commented 6 years ago

After further testing, when syncing from our node.js client the server isn't crashing. It seems to happen only with the iOS SDK.

Jonsapps commented 6 years ago

If I change my code to use Realm.asyncOpen from the iOS SDK the initial sync completes without causing the server to crash.

bigfish24 commented 6 years ago

What are the server logs when this crash happens? I am assuming your original issue of migrating is resolved to now just this issue?

Jonsapps commented 6 years ago

I haven't managed to migrate using the migrate command, that always fails to int index out of range exception, I have resorted to compacting the old realm v1 and copying the data from that compacted realm into my new ROS v2. Can you point me in the direction of the location of the relevant logs?

astigsen commented 6 years ago

Closing this for now as it relates to an outdated version of ROS. Please reopen if the problem persists with the latest version.