node-sass icon indicating copy to clipboard operation
node-sass copied to clipboard

3.3.0 segmentation fault 11 on OSX

Open bestander opened this issue 11 years ago • 47 comments

Node quits with "segmentation fault 11" when node-sass is required. I am using gulp-sass that depends on node-sass.

Mac OS X 10.10.5 node -v v2.3.0 npm -v 2.12.1

bestander avatar Aug 26 '15 03:08 bestander

Reverting to 3.2.0 fixes the problem

bestander avatar Aug 26 '15 03:08 bestander

:+1: I'm having the exact same issue

node -v
# v2.5.0
npm -v
# 2.13.2

I'm using it through gulp-sass though, so can't really revert.

eddiemoore avatar Aug 26 '15 03:08 eddiemoore

My guess is that you need to delete your node_modules and do a clean install.

Sounds like your system has kept the v3.2.0 rather than downloading the updated v3.3.0 binary.

xzyfer avatar Aug 26 '15 04:08 xzyfer

Nope, 3.3.0 is definitely causing the problem on my PC. Reverting 3.3.0 with 3.2.0 manually fixes the problem.

bestander avatar Aug 26 '15 04:08 bestander

@bestander please follow our troubleshooting guide and create a gist with all the output.

We're unable to reproduce this issue.

xzyfer avatar Aug 26 '15 04:08 xzyfer

I deleted my node_modules, and did a clean install. It shows segmentation fault 11 now.

yizhan avatar Aug 26 '15 04:08 yizhan

If someone could produce a scss sample that produce that the segfault that would greatly help.

xzyfer avatar Aug 26 '15 04:08 xzyfer

Sure will do.
I am using gulp-sass, so maybe the reason is that latest gulp-sass is not compatible with node-sass 3.3.0

bestander avatar Aug 26 '15 04:08 bestander

Hm, in an isolated case it does not throw the error:

var sass = require('gulp-sass');
var gulp = require('gulp');

gulp.task('test', function () {

});

But in our production system with a large gulp script just having

var sass = require('gulp-sass');

Segfaults node with error.

npm -v
2.12.1
node -v
v2.3.0
node -p process.versions
{ http_parser: '2.5.0',
  node: '2.3.0',
  v8: '4.2.77.20',
  uv: '1.6.1',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  modules: '44',
  openssl: '1.0.2c' }
node -p process.platform
darwin
node -p process.arch
x64

I'll try to investigate more

bestander avatar Aug 26 '15 04:08 bestander

It's not related to gulp-sass as I am currently using that without issue.

xzyfer avatar Aug 26 '15 04:08 xzyfer

@xzyfer I'm using the sass-loader for Webpack, that uses node-sass, and 3.3.0 definitely crashes Node with Segmentation Fault: 11. Downgraded to 3.2.0 and voila, it works.

enriquecaballero avatar Aug 26 '15 04:08 enriquecaballero

@eddiemoore @enriquecaballero @yizhan

Are you using node-sass via Gulp / Grunt, and which?

Please run the following commands

npm -v
node -v
node -p process.versions
node -p process.platform
node -p process.arch

xzyfer avatar Aug 26 '15 04:08 xzyfer

By pure fluke I was able to reproduce this in a gulp watch task. The stacktrace for segfault is

PID 42935 received SIGSEGV for address: 0x46
0   segfault-handler.node               0x00000001013fa90f _ZL16segfault_handleriP9__siginfoPv + 287
1   libsystem_platform.dylib            0x00007fff8e80a5aa _sigtramp + 26
2   ???                                 0x0000000103300450 0x0 + 4348445776
3   fse.node                            0x00000001036ee616 _ZN3Nan3imp10GetWrapperIPFvRKNS_20FunctionCallbackInfoIN2v85ValueEEEENS0_15FunctionWrapperEEEPT0_T_ + 142
4   fse.node                            0x00000001036eda40 _ZN3fse8FSEvents10InitializeEN2v86HandleINS1_6ObjectEEE + 194
5   node                                0x0000000100601047 _ZN4node6DLOpenERKN2v820FunctionCallbackInfoINS0_5ValueEEE + 725
6   node                                0x00000001001749ee _ZN2v88internal25FunctionCallbackArguments4CallEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEE + 158
7   node                                0x000000010019c97b _ZN2v88internalL19HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateERNS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE1EEE + 811
8   node                                0x000000010019f1cd _ZN2v88internalL21Builtin_HandleApiCallEiPPNS0_6ObjectEPNS0_7IsolateE + 61
9   ???                                 0x00001395f2e060bb 0x0 + 21534745845947

The culprit appears to fse.node which is part of the fsevents modules. This module is used in chokidar which in turn is use by many watchers like gulp and webpack.

I'm still digging into why node-sass is triggering this segfaulting behaviour in fsevents.

xzyfer avatar Aug 26 '15 06:08 xzyfer

Some suspect things I've noticed with regards to fsevents.

xzyfer avatar Aug 26 '15 06:08 xzyfer

Incase you still need it

node -v
# v2.5.0
npm -v
# 2.13.2
node -p process.versions
{ http_parser: '2.5.0',
  node: '2.5.0',
  v8: '4.2.77.21',
  uv: '1.6.1',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  modules: '44',
  openssl: '1.0.2d' }
node -p process.platform
# darwin
node -p process.arch
# x64

eddiemoore avatar Aug 26 '15 07:08 eddiemoore

@eddiemoore are you experiencing this through a watcher or in a singe gulp run?

xzyfer avatar Aug 26 '15 07:08 xzyfer

both. During a build and watch.

gulp.task('styles', () => {
  return gulp.src('src/styles/**/*.scss')
    .pipe($.sass().on('error', $.sass.logError))
    .pipe(gulp.dest('dist/styles'))
})

Using gulp-load-plugins in case you are wondering what the $ is.

eddiemoore avatar Aug 26 '15 07:08 eddiemoore

I've done some more digging and I believe this to be a bug in [email protected]. By locking to [email protected] I'm no longer able to reproduce this issue.


@enriquecaballero @eddiemoore @bestander can you please try the following:

Add this line as the first dependency on your package.json

  "dependencies": {
    "fsevents": "0.3.7"

Then delete your node_modules and do a fresh npm install.

xzyfer avatar Aug 26 '15 07:08 xzyfer

@xzyfer That solves the issue for now. Just hope this will be fixed soon without having to do this.

eddiemoore avatar Aug 26 '15 07:08 eddiemoore

Thanks @eddiemoore. That just helps confirm fsevents is the culprit. I've commented on their related issue https://github.com/paulmillr/chokidar/issues/219

xzyfer avatar Aug 26 '15 07:08 xzyfer