Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Segfault with function/map combination #1861

Closed
danez opened this issue Jan 17, 2017 · 5 comments
Closed

Segfault with function/map combination #1861

danez opened this issue Jan 17, 2017 · 5 comments

Comments

@danez
Copy link
Contributor

danez commented Jan 17, 2017

  • NPM version (npm -v): 4.1.1
  • Node version (node -v): 6.9.3
  • Node Process (node -p process.versions):
{ http_parser: '2.7.0',
  node: '6.9.3',
  v8: '5.1.281.89',
  uv: '1.9.1',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  icu: '57.1',
  modules: '48',
  openssl: '1.0.2j' }
  • Node Platform (node -p process.platform): linux
  • 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):
root@ /hdir
└── [email protected] 

We receive random segfaults when running grunt-sass on our large codebase. I used segfault-handler to catch the error and print something useful and this is all I got:

PID 19883 received SIGSEGV for address: 0x26a36c0
/hdir/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1b53)[0x7f3f104b2b53]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10330)[0x7f3f12a8e330]
[0x26a36c0]

I also tried compiling a debug version of the node-sass binding, but that didn't change the segfault output.

I tried changing grunt-sass to use sass.renderSync() and not do any async stuff, but besides being slower the same error appears again.

Our codebase works with 3.x

@danez
Copy link
Contributor Author

danez commented Jan 17, 2017

I found a small reproducable case: It seems grunt-sass is not relevant for this problem.

@function map-include($map, $keys...) {
  $map-include: ();
  @each $key in $keys {
    @if map-has-key($map, $key) {
      $map-include: map-merge($map-include, ($key: map-get($map, $key)));
    } @else {
      @error 'Oooops! #{$key} is not included in map #{$map}';
    }
  }
  @return $map-include;
}


$colors: (
        "white": #FFFFFF,
        "black": #000000,
        "green-50": #F0F7F7
);

$list-colors: map-include($colors, 'white', 'black') !default;

@danez danez changed the title Random segfault on large project Segfault with function/map combination Jan 17, 2017
@xzyfer xzyfer reopened this Jan 26, 2017
@xzyfer xzyfer closed this as completed Jan 26, 2017
@xzyfer
Copy link
Contributor

xzyfer commented Jan 26, 2017

Thanks for the reproduction @danez. This has been fixed in LibSass 3.5.0.beta.2 and will be released in [email protected] in the next couple days.

@xzyfer
Copy link
Contributor

xzyfer commented Jan 27, 2017

@danez can you confirm the segfault is resolved with node-sass@beta?

@danez
Copy link
Contributor Author

danez commented Jan 31, 2017

Sadly it still does not work, I open another ticket, as different problem.

@patrickording
Copy link

patrickording commented Feb 1, 2017

I ran into the same issue using scss maps having the following environment:

bildschirmfoto 2017-02-01 um 14 22 48

$grid-breakpoints: (
	'xs': 0,
	'sm': 480px,
	'md': 768px,
	'lg': 981px,
	'xl': 1200px
);

@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
	$min: breakpoint-min($name, $breakpoints);
	@if $min {
		@media (min-width: $min) {
			@content;
		}
	} @else {
		@content;
	}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants