Skip to content

Server crashes on node:alpine images #4654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Jagdeep1 opened this issue Mar 16, 2018 · 6 comments
Closed

Server crashes on node:alpine images #4654

Jagdeep1 opened this issue Mar 16, 2018 · 6 comments

Comments

@Jagdeep1
Copy link

Issue Description

Parse server is crashing on Login and Sign up requests for node:9-alpine or any other alpine images. It works fine on node:9 or any other node images.

Steps to reproduce

Expected Results

Should create new user

Actual Outcome

The server will crash with following trace
Segmentation fault npm ERR! code ELIFECYCLE npm ERR! errno 139 npm ERR! [email protected] start: node index.js npm ERR! Exit status 139 npm ERR! npm ERR! Failed at the [email protected] start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 2018-03-16T11:00:21.637131130Z npm ERR! A complete log of this run can be found in:

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : [2.7.4]
    • Operating System: [node:9-alpine]
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): [localhost]
  • Database

    • MongoDB version: [3.2]
    • Storage engine: [FILL THIS OUT]
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): [Remote - cosmosdb]

Logs/Trace

Log output 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', '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: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/parse/node_m 9 verbose lifecycle [email protected]~start: CWD: /parse 10 silly lifecycle [email protected]~start: Args: [ '-c', 'node index.js' ] 11 silly lifecycle [email protected]~start: Returned: code: 139 signal: null 12 info lifecycle [email protected]~start: Failed to exec start script 13 verbose stack Error: [email protected] start: node index.js13 verbose stack Exit status 139 13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16) 13 verbose stack at EventEmitter.emit (events.js:127:13) 13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:127:13) 13 verbose stack at maybeClose (internal/child_process.js:936:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5) 14 verbose pkgid [email protected] 15 verbose cwd /parse 16 verbose Linux 4.9.60-linuxkit-aufs 17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" 18 verbose node v9.7.1 19 verbose npm v5.6.0 20 error code ELIFECYCLE 21 error errno 139 22 error [email protected] start:node index.js 22 error Exit status 139 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 [ 139, true ]

@nbering
Copy link

nbering commented Mar 16, 2018

Parse server uses bcrypt, which includes native extensions. Incorrectly-built native extensions are often cause segfaults in NodeJS.

Did your docker build run npm install inside the container, or just copy node_modules from your dev machine?

@nbering
Copy link

nbering commented Mar 16, 2018

Apologies... I missed the part where you said you were using the Dockerfile from parse server.

It's probably a similar issue though. From what I've been told, Alpine uses a completely different set of C standard libraries than your typical linux installation. It's part of how they get the image so small.

There's probably some incompatibility between the native extensions in libraries like bcrypt and the alpine distribution. Would be helpful to know which module caused the crash... I'm not close enough to Parse to recognize anything in the error output.

@nbering
Copy link

nbering commented Mar 16, 2018

One last thing... do you think you could put the log output in a fenced code block please? It would preserve the spacing and make it easier to read. Fenced codeblocks start and end with three backticks, like this:

```
Log content...
```

@Jagdeep1
Copy link
Author

Yes I run yarn to install nnode modues

Now I have tried copying local node_module, and it works fine.

Sorry about the logs, here is formatted

1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', '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: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/parse/node_m
9 verbose lifecycle [email protected]~start: CWD: /parse
10 silly lifecycle [email protected]~start: Args: [ '-c', 'node index.js' ]
11 silly lifecycle [email protected]~start: Returned: code: 139  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `node index.js`
13 verbose stack Exit status 139
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack     at EventEmitter.emit (events.js:127:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:127:13)
13 verbose stack     at maybeClose (internal/child_process.js:936:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid [email protected]
15 verbose cwd /parse
16 verbose Linux 4.9.60-linuxkit-aufs
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v9.7.1
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 139
22 error [email protected] start: `node index.js`
22 error Exit status 139
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 [ 139, true ]

@samuelantonioli
Copy link

For me it was the bcrypt error. Just resorted to node:latest which currently uses Debian Jessie.

If you have a pressing need to use Alpine, let me know and I will investigate.

@flovilmart
Copy link
Contributor

As @nbering mentions, if you want to use node alpine, you’ll need to change the dockerfile so it runs ‘npm install’ and therefore installs all the dependencies for the right architecture. Also, this is an issue with parse-server-example which is not the recommended way to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants