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

Segmentation fault on undefined mixin #446

Closed
paazmaya opened this issue Jul 17, 2014 · 7 comments
Closed

Segmentation fault on undefined mixin #446

paazmaya opened this issue Jul 17, 2014 · 7 comments

Comments

@paazmaya
Copy link
Contributor

With the latest dev version stack of grunt-sass, node-sass, libsass and sass2scss, once a mixin that does not exist is used, the following segmentation fault occurs:

PID 2574 received SIGSEGV for address: 0x0
0   segfault-handler-native.node        0x00000001009f1b78 _ZL16segfault_handleriP9__siginfoPv + 192
1   libsystem_platform.dylib            0x00007fff972ee5aa _sigtramp + 26
2   ???                                 0x000000000000000d 0x0 + 13
3   node                                0x000000010014cf7c _ZN2v86String3NewEPKci + 214
4   binding.node                        0x0000000103f48ea1 _Z12FillStatsObjN2v86HandleINS_6ObjectEEEP17sass_file_context + 42
5   binding.node                        0x0000000103f48fca _Z12MakeCallbackP9uv_work_s + 136
6   node                                0x0000000100138eb0 uv__work_done + 168
7   node                                0x000000010012fcfd uv__async_event + 62
8   node                                0x000000010012fe70 uv__async_io + 136
9   node                                0x000000010013c7be uv__io_poll + 1427
10  node                                0x00000001001302b5 uv_run + 239
11  node                                0x000000010000c01e _ZN4node5StartEiPPc + 365
12  node                                0x00000001000030f4 start + 52
13  ???                                 0x0000000000000003 0x0 + 3

With a minimal example the error is handled properly, with a message that the given mixin is undefined.
However with my "massive" Sass code this happens. I will try to extract a minimal example where this occurs.

@paazmaya
Copy link
Contributor Author

The following Sass:

=query
  @media screen
    @content

.selector-with-dash
  +query
    p
      color: rebeccapurple
      +doesnotexist

.selector
  text-decoration-color: blue

The failure "might" be related to source maps, as changing that option creates a different error as show below. Both examples are run via grunt-sass.

Files: undefined-mixin.sass -> undefined-mixin.css
Options: precision=10, sourceComments="map", sourceMap
PID 23404 received SIGSEGV for address: 0x0
0   segfault-handler-native.node        0x00000001009f1b78 _ZL16segfault_handleriP9__siginfoPv + 192
1   libsystem_platform.dylib            0x00007fff972ee5aa _sigtramp + 26
2   ???                                 0x000000000000000d 0x0 + 13
3   node                                0x000000010014cf7c _ZN2v86String3NewEPKci + 214
4   binding.node                        0x0000000103fcbea1 _Z12FillStatsObjN2v86HandleINS_6ObjectEEEP17sass_file_context + 42
5   binding.node                        0x0000000103fcbfca _Z12MakeCallbackP9uv_work_s + 136
6   node                                0x0000000100138eb0 uv__work_done + 168
7   node                                0x000000010012fcfd uv__async_event + 62
8   node                                0x000000010012fe70 uv__async_io + 136
9   node                                0x000000010013c7be uv__io_poll + 1427
10  node                                0x00000001001302b5 uv_run + 239
11  node                                0x000000010000c01e _ZN4node5StartEiPPc + 365
12  node                                0x00000001000030f4 start + 52
13  ???                                 0x0000000000000004 0x0 + 4
Files: undefined-mixin.sass -> undefined-mixin.css
Options: precision=10, sourceComments="map", sourceMap=false
Assertion failed: (val->IsString()), function _NanGetExternalParts, file ../node_modules/nan/nan.h, line 1990.
Abort trap: 6

@paazmaya
Copy link
Contributor Author

With inline comments, the given and expected output appears:

Files: undefined-mixin.sass -> undefined-mixin.css
Options: precision=10, sourceComments="inline", sourceMap
Warning: undefined-mixin.sass:9: error: no mixin named doesnotexist
Backtrace:
    undefined-mixin.sass:9, in mixin `@content`
    undefined-mixin.sass:3, in mixin `query`
    undefined-mixin.sass:6
 Use --force to continue.

@paazmaya
Copy link
Contributor Author

Even a small Sass as this triggers the above described behaviour:

.selector
  color: rebeccapurple
  +doesnotexist

@akhleung
Copy link

I'm not able to reproduce the error when running LibSass on its own ... given the various other segfaults that have been occurring with Node-Sass (which I can't reproduce when running LibSass standalone), I'm starting to think that there might be something wrong with how they're handling LibSass errors....

@paazmaya
Copy link
Contributor Author

Thanks for the tip, will look at node-sass more in depth.

@am11
Copy link
Contributor

am11 commented Jul 31, 2014

I tend to believe that I have fixed this issue via:

Those PRs are awaiting review / merge.

@paazmaya
Copy link
Contributor Author

paazmaya commented Aug 4, 2014

Indeed, sass/node-sass#366 seems to fix this issue and results in showing better message about the non existing mixin.
Thank you @am11

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

4 participants