Realm-js: Realm crashes on Windows, when using Node version higher than 8.x

Created on 11 Oct 2019  ·  23Comments  ·  Source: realm/realm-js

Goals

With Node.js 8, getting closer to becoming unsupported (https://nodejs.org/en/about/releases/), I'm trying to get Realm to work with newer versions of Node under Windows.

Expected Results

Install and work properly on Windows OS.

Actual Results

Crashes whenever you try to connect to Realm.
(code ELIFECYCLE errno 3221225477)

Steps to Reproduce

  1. Install Node.js version, higher than 8.x (ex. 10.16.3 LTS).
  2. Install Realm.
  3. Try opening any realm.

Version of Realm and Tooling

  • Realm JS SDK Version: 3.2.0
  • Node or React Native: 10.16.3
  • Client OS & Version: Windows 10 Pro 64 bit
  • Which debugger for React Native: None

┆Attachments: github-2560.stacktrace.txt

O-Community T-Bug-Crash

Most helpful comment

@RosenTomov Thanks I was able to reproduce the problem. We will investigate it further

All 23 comments

@RosenTomov Thanks for reporting. Do you also experience it with earlier versions of Realm?

You are able to install Realm? I see a similar error in https://stackoverflow.com/questions/45245920/elifecycle-npm-error.

@blagoev Have you seen this error on Windows?

Hi kneth,

Yes it installs fine, but crashes, when trying to connect. This happened even on older versions of Realm, when using anything above Node 8.x.

(versions from 2.15.3 till 2.22.0 didn't work on Windows at all on any node version, I just found my old support tickets).

Clearing npm cache and deleting node_modules didn't work, I even tested it on a newly installed Windows.

Here's an example error log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'D:\\test\\Server\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: D:\test\Server\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\test\Server\node_modules\.bin;D:\test\Server\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\nodejs\;C:\Users\test\AppData\Local\Microsoft\WindowsApps;C:\Users\test\AppData\Local\GitHubDesktop\bin;D:\Tools\gradle-5.6.2\bin;C:\Users\test\AppData\Local\Yarn\bin;C:\Users\test\AppData\Local\Android\Sdk\platform-tools;C:\Users\test\AppData\Local\Android\Sdk\emulator;;C:\Users\test\AppData\Local\Microsoft\WindowsApps;C:\Users\test\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: D:\test\Server
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c',
10 silly lifecycle   'cross-env NODE_ENV=localDevelopment babel-node ./src/index.js' ]
11 silly lifecycle [email protected]~start: Returned: code: 3221225477  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `cross-env NODE_ENV=localDevelopment babel-node ./src/index.js`
13 verbose stack Exit status 3221225477
13 verbose stack     at EventEmitter.<anonymous> (D:\test\Server\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (D:\test\Server\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd D:\test\Server
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "D:\\test\\Server\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v10.16.3
19 verbose npm  v6.11.3
20 error code ELIFECYCLE
21 error errno 3221225477
22 error [email protected] start: `cross-env NODE_ENV=localDevelopment babel-node ./src/index.js`
22 error Exit status 3221225477
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225477, true ]

Thanks.

Can you post a minimal script which leads to the error?

package.json

{
  "name": "testproject",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js",
    "start-babel": "babel-node index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "realm": "^3.1.0"
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-preset-env": "^1.7.0"
  }
}

index.js

const Realm = require('realm');

const realmUsername = 'Username';
const realmPassword = 'Password';
const realmServerURL = 'Realm url without https:// or realms://';

const CarSchema = {
  name: 'Car',
  properties: {
    make:  'string',
    model: 'string',
    miles: {type: 'int', default: 0},
  }
};


(async () => {
  const currentCredentials = Realm.Sync.Credentials.usernamePassword(
    realmUsername,
    realmPassword
  );

  const user = await Realm.Sync.User.login(
    `https://${realmServerURL}`,
    currentCredentials
  );

  const databaseOptions = {
    schema: [CarSchema],
    sync: {
      url: `realms://${realmServerURL}/test`,
      user
    }
  };

  console.log('Before connecting');

  const realm = await Realm.open(databaseOptions);
  realm.write(() => {
    realm.create('Car', {
      make: 'Honda',
      model: 'Civic',
      miles: 1000,
    });
  });

  console.log('End');
})();

Just replace the values in these
const realmUsername = 'Username';
const realmPassword = 'Password';
const realmServerURL = 'Realm url without https:// or realms://';

and from scripts use
"start": "node index.js",
or
"start-babel": "babel-node index.js"

@RosenTomov Thanks I was able to reproduce the problem. We will investigate it further

Hello, I'd like to add that Realm also crashes on Windows with ELIFECYCLE 3221226505 (stack buffer overflow?) when trying to connect to a realm with partial sync (fullSynchronization: false), no matter the Node version.

@blagoev Will https://github.com/realm/realm-js/pull/2579 solve the issue?

@kneth No this is a fix for something else.
The crash here is related to sync and openssl versions

Any updates on this? We experience exact same problem. Node 8 will reach end-of-life on 2019-12-31.

Sorry to add a "me too" to this issue, but I'm also encountering the same problems on Windows 10 Pro x64. App crashes when trying to execute Realm.open in the following cases:

  • Full synchronization (fullSynchronization: true) on Node higher than 8.x. Exit code 3221225477.
  • Partial synchronization (fullSynchronization: false) on any Node version. Exit code 3221226505.

@RosenTomov @rgilmutdinov Please upgrade realm to the latest Realm JS version. It should have this crash fixed.

Closing this issue. Feel free to reopen if it's not fixed for you

➤ Unito Sync Bot commented:

Transition made by Unito

Hello @blagoev ,
I've just tried 3.5.0 and it's still crashing. Tested with node v10.17.0.

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\PC\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Users\PC\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\GitHub-Repository\test\Server\node_modules\.bin;E:\GitHub-Repository\test\Server\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;E:\Programs\Yarn\bin\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\PC\AppData\Local\Microsoft\WindowsApps;C:\Users\PC\AppData\Local\GitHubDesktop\bin;C:\Users\PC\AppData\Local\Microsoft\WindowsApps;C:\Users\PC\AppData\Local\atom\bin;C:\Users\PC\AppData\Local\Yarn\bin;C:\Program Files\nodejs;E:\Programs\AndroidSDK\emulator;E:\Programs\AndroidSDK\platform-tools;C:\Program Files\Git\bin;C:\Users\PC\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: E:\GitHub-Repository\test\Server
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c',
10 silly lifecycle   'cross-env NODE_ENV=development babel-node ./src/index.js' ]
11 silly lifecycle [email protected]~start: Returned: code: 3221225477  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `cross-env NODE_ENV=development babel-node ./src/index.js`
13 verbose stack Exit status 3221225477
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\PC\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\PC\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd E:\GitHub-Repository\test\Server
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\PC\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v10.17.0
19 verbose npm  v6.13.1
20 error code ELIFECYCLE
21 error errno 3221225477
22 error [email protected] start: `cross-env NODE_ENV=development babel-node ./src/index.js`
22 error Exit status 3221225477
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225477, true ]

Thanks, I will retry with 3.5 that was just released.
reopening this issue

@RosenTomov Yes indeed. My reporting on this not crashing was based on the fact I was testing with the wrong environment.
We are going to look at this some more.

I just noticed that 3.6.0 got released, does it include any fixes for this issue?

@RosenTomov Unfortunately no.

Hello, I've just tested Realm version 5.0.0 with Node 10.19.0 on Windows and its still broken 😢

node index.js just exists the process while trying to connect to realm. I'm using the code above for testing.

Yes that's still a known unfixed issue. It's proven difficult to track, but we will be looking more into that, now that 5.0 is released.

@RosenTomov We just released Realm JS v5.0.5 with a fix for this. Go ahead and try it on your environment.

@blagoev I can confirm that it works on both Node 10 and 12 (haven't tried higher). 👍


Also a note for anyone that needs to keep using an older realm version for some reason - try running it with "windows subsystem for linux". Node 10 worked fine, 12 gave me some trouble, it would start Realm instances multiple times when hot reloading and throw an error.

I still get this error on Windows 10. I've tried with both NPM and Yarn and with Node 12.18.2 and v10.18.1.

Every time there is an error in Realm (for example, if something is wrong in the schema. this error is shown instead of the real error message.

npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477
npm ERR! [email protected] importModel: `ts-node ./importModel.ts`
npm ERR! Exit status 3221225477
npm ERR!
npm ERR! Failed at the [email protected] importModel script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

MihaelIsaev picture MihaelIsaev  ·  3Comments

kevinnguy picture kevinnguy  ·  3Comments

kontinuity picture kontinuity  ·  3Comments

blagoev picture blagoev  ·  3Comments

bdebout picture bdebout  ·  3Comments