Skip to content
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

segfaults #168

Closed
noahgrant opened this issue Dec 11, 2014 · 15 comments
Closed

segfaults #168

noahgrant opened this issue Dec 11, 2014 · 15 comments

Comments

@noahgrant
Copy link

This is a repeat issue that I had originally posted in gulp, but it looks like it's a gaze issue, and I'm wondering if anyone can give me any insight, or if maybe I should try one of the other watchers like chokidar for the time being. Thank you!!

I've searched and searched and haven't come across anyone else who has experienced this issue, but my gulp tasks segfault fairly often. The thing is, it's hard to pinpoint, because it happens with multiple tasks. Most often, it happens while gulp-modernizr is building a custom modernizr file, causing all tasks, including my local server (with gulp-webserver) and watcher to stop. If I run gulp modernizr separately from my other default tasks, it caches the file, and then won't segfault—most of the time. But sometimes it still does. And sometimes, when I remove the modernizr task completely from my list of tasks, it still segfaults (though much less often). Even if I include the modernizr tool but don't launch the webserver or watcher. In fact, I've gone through every combination of tasks trying to single the problem out, and after doing some more looking, it might be a common issue with both node-sass (much less often) and gaze (much more common). Here is a common output from the modernizr task when it fails:

...

>> Ready to build using these settings:
>> setClasses, addTest, html5printshiv, testProp, fnBind

Building your customized Modernizr
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
>> Local Npm module "grunt-saucelabs" not found. Is it installed?
>> Local Npm module "grunt-contrib-qunit" not found. Is it installed?
>> Local Npm module "grunt-contrib-nodeunit" not found. Is it installed?
..Segmentation fault: 11

(it fails as it's doing the actual file-building. When it succeeds, the last line prints ...........OK.)

I'm on OS X Yosemite, I'm using browserify/watchify for js, gulp-sass with node-sass/libsass for sass, and I've had to up the limit on the number of watchable files, and here's my offending gulp task looks something like:

...

gulp.task('default', function(cb) {
  runSequence('clean', ['js', 'modernizr', 'sass', 'jade', 'svg', 'copy'], 'serve', 'watch', cb);
});

Any insight as to why this might be happening regularly with gaze or what can be done about it would be greatly, greatly appreciated.

Thank you!

@shama
Copy link
Owner

shama commented Dec 11, 2014

Are you able to get a stack trace or more detail as to when your build is segfaulting? Maybe reduce an example to reproduce the issue? You could also try with node-debug to pinpoint the issue.

With all the libraries involved, I likely can't help determine the issue. It might be an issue in gaze (although I haven't seen that issue reported here yet) or it could be an issue any of those other libraries. Feel free to try another file watcher if you can. It might give some indication but without a reproducible example, I won't be able to help. Sorry!

@noahgrant
Copy link
Author

Okay when I get a chance I will try to use node-debug to get a stack trace, thanks!

It's really hard for me to get a reproducible example---it happens in so many different configurations, including without the watcher running. running gulp-modernizr might work 5 times in a row, and it might segfault 5 times in a row. I could leave out gulp-modernizr, and node-sass might segfault (though, rarely). I'm pretty stuck on this one, so thanks for the node-debug tip. I'll report back when/if I've found out more.

@noahgrant
Copy link
Author

@shama on a side note, I know you're working on a big gaze update; is there anywhere that you have posted a list of improved features?

@shama
Copy link
Owner

shama commented Dec 18, 2014

@noahgrant Just what is in the issue tracker and mostly focused on #137.

@noahgrant
Copy link
Author

@shama Awesome, can't wait! Do you have a date in mind for the next release?

@shama
Copy link
Owner

shama commented Dec 23, 2014

I'm going to keep the release date a surprise.

@noahgrant
Copy link
Author

Ah okay, we're having some issues with it that i think might be solved by the new release, so we may have to swap it out for something else in the meantime, then.

@noahgrant
Copy link
Author

As an update, I was able to use this segfault stack trace helper to generate this trace (the top entry is from the library):

PID 1064 received SIGSEGV for address: 0x10
0   segfault-handler.node               0x0000000100cf647f _ZL16segfault_handleriP9__siginfoPv + 287
1   libsystem_platform.dylib            0x00007fff8d4b4f1a _sigtramp + 26
2   ???                                 0x0000000101009800 0x0 + 4311783424
3   node                                0x000000010043c721 uv__async_event + 62
4   node                                0x000000010043c894 uv__async_io + 136
5   node                                0x0000000100449229 uv__io_poll + 1427
6   node                                0x000000010043ccd9 uv_run + 239
7   node                                0x00000001003f758a _ZN4node5StartEiPPc + 365
8   node                                0x0000000100001134 start + 52

I'm not sure how to go about diagnosing this, but at least this is a start. I've seen segfault github issues for the fsevents library and for chokidar.

@noahgrant
Copy link
Author

maybe we need something like this that swallows the error?

@shama
Copy link
Owner

shama commented Mar 6, 2015

Nice, I'll have to check out that segfault stack trace helper as I have no idea how to read the above.

I'm totally open to a PR to swallow the error too. If you've got a change that fixes it by swallowing, feel free to open and I'll port it to https://github.com/shama/navelgazer or just open a PR there. Thanks!

@noahgrant
Copy link
Author

Well, I'm certainly down to take a look, but I'd need some help getting the project set up to edit any c files. Do I just run node /path/to/build.js --force? Also, how are the files in the src dir related if this project relies on navelgazer?

@shama
Copy link
Owner

shama commented Mar 7, 2015

With navelgazer cloned and npm i ran with all the deps installed. You can run npm run buildtest to force a build and run the tests. Otherwise yep, just node build.js --force from within the folder to build the src/ files.

If you want to test integrating into gaze, run npm link inside the navelgazer folder. Then clone the navelgazer branch of gaze with git clone -b navelgazer git://github.com/shama/gaze and run npm i in that folder. Finally run npm link navelgazer to create a symlink'd module.

The src/ files in navelgazer, when built by node-gyp creates a bin/[platform-arch-v8]/pathwatcher.node file which is the node.js native addon. We then require the native addon and this lets us access the interface via javascript.

I appreciate your help!

@noahgrant
Copy link
Author

also, is there a number of watched files at which gaze might stop working as well?

@noahgrant
Copy link
Author

@shama you can close this issue--it turns out that the version of gulp-watch we're using is using gaze 0.5.x, which I just realized doesn't do its own native bindings.

@shama
Copy link
Owner

shama commented Mar 30, 2015

Thanks for letting me know and the work you put in looking into this!

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

2 participants