-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Segmentation fault upon syntax error #1672
Comments
@montchr can you try to prepare some minimal case to reproduce the problem? |
Okay I've been able to track it down to https://gist.github.com/montchr/2d725069a91abc25f8db3462342f98f6 The main There are some other files:
If the set of three rules in Two important things to note:
I'm running |
As a side note, I've searched my project and its dependencies for references to |
The good news is that with
I cannot reproduce this problem anymore. Running
|
Running
The output is:
Can you check what are you getting just by running |
With
|
Can you check if grunt is not installing an older version of node-sass by chance? |
I have used the following
and after
|
My
I should also mention that a collaborator on my project is working with the same set of files and they're getting segmentation faults as well. This issue only appeared for us in the past couple weeks, but even with the minimal project in my gist and clearing out Edit: I'm running node v6.4.0 by the way. I switched to your version v6.2.2 with |
er, can you take nvm out of the way? |
Since it looks like an environmental issue to me, can you please follow https://github.com/sass/node-sass/blob/master/TROUBLESHOOTING.md and post the output? |
I downgraded to 5.5.12 without Here's the output of some of those commands. If you want me to run anything else let me know.
|
What happens if you run Did you create a clean workspace in the temporary directory? |
That's what I ran above actually:
|
Can you post the full output of |
|
I also created a new user account on my machine and tested there. I still get a segfault, but with a slightly different message |
Thanks. It seems that the node (JavaScript) thread continues normally and we are getting the error message back. The back-end libsass thread crashes though. Looks like a race condition somewhere. Unfortunately, I cannot reproduce this locally on my systems, so I might need access to a Mac to troubleshoot this. |
@xzyfer can you reproduce this as well? |
The "race-condition" is probably just grunt-sass running multiple instances of |
I am able to reproduce this locally. I have been able to confirm the issue is only present when colors"` is present. Inline that code into the scss files does not produce the segfault. |
Reproducible with Node v5.10.1
|
Confirmed this issue is present going to back to node-sass@v3.4.2. |
Thanks. The stacktrace also points to the color name conversion routines. In my repo there are two files that grunt tries to process, |
If I change |
Actually I've found that if I copy the contents of |
@montchr I saw this comment but was not able to reproduce the segfault in that case
I was not able to reproduce the segfault in this case. I also tried executing multiple instances of the node-sass cli in a loop and was not able to reproduce this. Would be good if you could confirm this @saper. |
Thanks @xzyfer, this is helpful. This is probably related to multiple parallel calls to I have two theories why it fails, the pessimistic one is that we got bitten by mixing of C++ on MacOS, we use a modern C++11 library when compiling libsass and the stock GNU one to talk to node, as explained in #1110 I can't reproduce this at all on other platforms, unfortunately. |
I ran into an extremely similar issue today using node v12.6.0, node v12.13.0 and node v13.1.0, with node-sass v4.13.0. It occurs even after completely fresh npm installs, on my and my colleague's OS X machines and in our Docker based GitLab runners. Coincidentally my stack trace also includes
We're using tsdx and rollup-plugin-postcss to build the code. The |
Can you produce a minimal reproduction case? |
Looks like I was running into 2 issues, and I might have concluded too soon that they're all caused by the segmentation fault. Upon making a reproduction repository I learned that the segmentation fault seems to indeed only be reproducible on macOS. The other issue completely freezes the build process upon I made a reproduction repository with minimal SASS code and minimal build configuration to reproduce these two issues. I also configured GitHub Actions to make debugging easier (see the actions tab on the repository). There is also a readme with steps to reproduce, possible outcomes and my observations. You can find it all here: https://github.com/EmicoEcommerce/node-sass-segfault-repro |
Great, thanks! Regarding hanging processes - I think this might be the architectural problem we are facing documented in #857. Can you try a workaround as documented there with environment variable and see if that helps? |
Split out the parallel imports problem to #2789 |
Your segmentation fault could be a stack overflow. I can generate a crash setting libuv/libuv#669 MacOS X was affected by a small stack size, and it is known that alpine has very small stacks, too. See also libuv/libuv#2310 libuv/libuv#1507 |
I have another theory: From the backtraces we can see that It looks to me that we explicitly turn off exception handling for MacOS X in Could anyone with Mac OS X rebuild the binding with Do we have a test case for the nesting error? |
Seems like that using Maybe C++ exceptions and multiple libsass threads (#2789) do not go well together, but why nesting limit? The limit should be the same on all platforms. |
On non-macOS systems we also inherit clang++ '-DNODE_GYP_MODULE_NAME=binding' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/usr/local/include/node -I/usr/local/src -I/usr/local/deps/openssl/config -I/usr/local/deps/openssl/openssl/include -I/usr/local/deps/uv/include -I/usr/local/deps/zlib -I/usr/local/deps/v8/include -I../node_modules/nan -I../src/libsass/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -std=c++0x -MMD -MF ./Release/.deps/Release/obj.target/binding/src/sass_types/number.o.d.raw -I/usr/local/include -g -c -o Release/obj.target/binding/src/sass_types/number.o ../src/sass_types/number.cpp |
I think I did this right: clone, install, change that value in binding.gyp, build, npm link, verify it uses the correct binary by reading the output of I don't see a difference when using that binary. |
I'm using
grunt-sass
to compile several files across my project. If there are no syntax errors, everything runs smoothly. If I run into a syntax error or any similar error, I encounter a segmentation fault. I've usednode-segfault-handler
to get the following log:The issue also seems connected to how many files or how many
@import
statements are being processed. If I move all the files out of the watched directories and leave just one file, it fails on syntax error just fine without a segfault. If I add two, three, four files with just a few imports, it's still fine. But then I add another file with a lot of imports, and the segfault appears again. If I leave that last file where the segfault was just introduced, and I remove all the others, there's no issue, so it doesn't appear to be connected to particular files.I've searched for solutions to this issue for a while but I've picked up on few patterns between the failures and none of the other Sass segfault solutions out there have worked. I've tried:
rm -rf node_modules && npm cache clear && npm install
grunt-sass
to previous versions (which track previous versions ofnode-sass
)node
to previous versionsThe text was updated successfully, but these errors were encountered: