Segfault when compilation raises errors #1858
Description
A part of our SASS code generates segfaults when compiled with node-sass (I'm using grunt-sass for the compilation) in case something goes wrong with the compilation. I've tried to figure out what may be causing it but I'm really drawing a blank here, so perhaps someone with better insight into node-sass or libsass can help me out.
I have an example repo here in which I've cut down as much of the code as possible: https://github.com/richardsimko/sass-segfault
Running grunt sass
after checking out and installing will crash with a segfault.
I have found the following clues:
- If there are no errors (In this case there is an import to a file that does not exist) then it all compiles fine, as such the CSS should be fine.
- Removing all CSS code from the file
_organizer.scss
fixes the issue (I.e. a proper exit without segfaults even on error) - Removing some of the code from
_organizer.scss
causes the error to become infrequent, for example removing approximately 100 lines causes it to only happen about 1/4 of the times - Errors in the file admin.scss does not cause the problem (Uncomment the line that says
//@import 'uncomment me to test not found here';
to test) - We're tried this on a number of different machines with the same result, however they were all Mac environments so I'm hoping for someone else to be able to test and duplicate it
- I've seen a few tickets related to segfaults in libsass previously but they've all been fixed
- It may be related to the variables, removing all references to variables in
_organizer.scss
also fixes the issue - The files are syntactically correct, moving all the variables from
_config.scss
into_organizer.scss
and running it using http://www.sassmeister.com/ provides a clean compilation - Removing about 10 or so of the unused variables also fixes the segfault issue
Output
bash-3.2$ grunt sass
Running "sass:test" (sass) task
>> Error: File to import not found or unreadable: intentionally not found.
>> Parent style sheet: /Users/richard/Desktop/Refined Wiki/temp/sass-test/test/modules.scss
>> on line 2 of test/modules.scss
>> >> @import 'intentionally not found';
>> ^
Warning: Use --force to continue.
Aborted due to warnings.
Segmentation fault: 11
Environment Info
-
NPM version (
npm -v
): 4.1.1 -
Node version (
node -v
): 4.7.0 -
Node Process (
node -p process.versions
):{ http_parser: '2.7.0', node: '4.7.0', v8: '4.5.103.43', uv: '1.9.1', zlib: '1.2.8', ares: '1.10.1-DEV', icu: '56.1', modules: '46', openssl: '1.0.2j' }
-
Node Platform (
node -p process.platform
): darwin -
Node architecture (
node -p process.arch
): x64
-
node-sass version (
node -p "require('node-sass').info"
):node-sass 4.3.0 (Wrapper) [JavaScript] libsass 3.4.3 (Sass Compiler) [C/C++]
-
npm node-sass versions (
npm ls node-sass
):
npm ls node-sass
:
sass-test@1.0.0
└─┬ grunt-sass@2.0.0
└── node-sass@4.3.0