Segmentation fault on Node 8 alpine (docker)
Works with node 6 and on my host machine ( debian, node 8 )
this is my project, can also try to make a smaller testcase if required https://github.com/ForsakenHarmony/portfolio
yarn build v0.24.6
$ cross-env NODE_ENV=production npm run webpack
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle [email protected]~prewebpack: [email protected]
npm info lifecycle [email protected]~webpack: [email protected]
> [email protected] webpack /usr/src/app
> webpack --progress --colors --config webpack.config.js
12% building modules 20/21 modules 1 active ...!/usr/src/app/client/styles/main.scssSegmentation fault (core dumped
)
npm info lifecycle [email protected]~webpack: Failed to exec webpack script
npm ERR! code ELIFECYCLE
npm ERR! errno 139
npm ERR! [email protected] webpack: `webpack --progress --colors --config webpack.config.js`
npm ERR! Exit status 139
npm ERR!
npm ERR! Failed at the [email protected] webpack 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! /root/.npm/_logs/2017-06-26T22_44_11_188Z-debug.log
error Command failed with exit code 139.
Removing intermediate container 5cb53913df5e
- NPM version (
npm -v): 5.0.3 - Node version (
node -v): v8.1.2 - Node Process (
node -p process.versions): { http_parser: '2.7.0', node: '8.1.2', v8: '5.8.283.41', uv: '1.12.0', zlib: '1.2.11', ares: '1.10.1-DEV', modules: '57', openssl: '1.0.2l', icu: '59.1', unicode: '9.0', cldr: '31.0.1', tz: '2017b' } - Node Platform (
node -p process.platform): linux - Node architecture (
node -p process.arch): x64 - node-sass version (
node -p "require('node-sass').info"): node-sass 4.5.3 (Wrapper) [JavaScript] libsass 3.5.0.beta.2 (Sass Compiler) [C/C++]
Can you add the log to a Gist? I'm not seeing anything in the current output, besides that it failed around a Sass file, that indicates this is a node-sass issue.
I'd also suggest just trying to reproduce it without webpack
https://gist.github.com/ForsakenHarmony/3ddcfcab7e932a5a6a48094eda7854c7
I'm not quite sure what's going on, it only seems to happen in the docker build script, not if I run it inside the container
may also be my code, because this doesn't crash
FROM node:8-alpine
RUN mkdir -p /usr/app
WORKDIR /usr/app
RUN yarn add node-sass
ENV NODE_ENV production
RUN node -e "require('node-sass').renderSync({data: '* {height: 2px}'});"
It does not seem to crash. Looks like a permission problem, people usually run as root inside a container, check our troubleshooting guide for info on unsafe permissions
Segmentation fault is a type of crash to me
I am sorry, didn't scroll that far right. Can you try to get the core file?
Quick question, are project files copied from Debian?
You'll need to delete your node_modules and reinstall your modules inside the container. Copying files from (or reusing a cache) between debian and alpine is going to result in segfaults.
@saper the core file?
also yes, copied from debian
node_modules doesn't get copied ( doesn't exist )
I get the feeling it's the build itself
probably your binding.node is copied/cached from Debian, this way it has to crash.
it also happens in ci
Having exact same issue. Fails with segmentation fault after a clean build and run inside Alpine image based on this Dockerfile (Node 8.1 + build essentials).
Works fine when doing the same thing inside image from this Dockerfile (Node 6.11 + build essentials).
Between 6 and 8, the node images changed from Alpine 3.4 to 3.6 so there may be some difference there. We did use their image to build our binaries though
@mikestead can you run npm rebuild node-sass --force within the Node 8.1 container and confirm whether the segfault is still present?
Also can you supply a minimal scss code sample the produces the segfault so we can investigate further?
tried rebuilding in the Dockerfile, didn't change anything
@ForsakenHarmony thanks. If a fresh local recompiled binary is still segfaulting I'm not sure what we can do. This could be an issue with Node 8 or Nan.
FWIW I'm seeing something similar but nothing to do with node-sass.
I've had a node application running FROM node:8-alpine for a while now with no problems. I've been toying with using babel-preset-env to transpile code in a version-aware manner. Presumably this means that more of my code is now using native ES features that are available in node 8 features rather than transpiled ES5 code.
Anyway, something has changed and the app crashes with Segmentation Fault when I try to log in (works fine up until this point). Switching the Dockerfile back to FROM node:8 fixes the issue.
https://gist.github.com/ForsakenHarmony/7efb3659dac985a90598b869b07c7e46
this is the dockerfile I tested with, project is linked in the main post
I am experiencing the same problem with a switch from Node 6 to 8.1.4 (alpine-based images).
Edit: I can confirm that not using an alpine-based image solves the problem (at least my problem).
Can anyone provide a backtrace for this?
I could not reproduce this bug on this example but in my case it happen too. This is a trace from my app https://gist.github.com/pawelpalka81/b6899c60551f7db20376b5e330aa1702