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

Sass worker compilation aborts and all compilations fail after #85

Closed
jws305 opened this issue Jul 27, 2017 · 12 comments
Closed

Sass worker compilation aborts and all compilations fail after #85

jws305 opened this issue Jul 27, 2017 · 12 comments

Comments

@jws305
Copy link

jws305 commented Jul 27, 2017

I am using sass.js in the browser using the sass.worker.js. The worker recompiles css as the user changes variables. After a while, the worker starts emitting errors on compilation, even when the input is valid.

Here are some of the errors emitted, all of which have a status code of 99:

abort(7) at Error
    at jsStackTrace (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:5:17538)
    at stackTrace (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:5:17709)
    at abort (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:32:10464)
    at Array.Bqa (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:25:75425)
    at Array.XH (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:11:65879)
    at Object.Caa [as dynCall_iiii] (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:25:38651)
    at invoke_iiii (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:5:451968)
    at Array.Cr (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:10:63261)
    at Object.Caa [as dynCall_iiii] (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:25:38651)
    at invoke_iiii (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:5:451968)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
abort(15) at Error
    at jsStackTrace (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:5:17538)
    at stackTrace (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:5:17709)
    at abort (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:32:10464)
    at Array.Aea (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:25:49586)
    at Array.Ft (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:10:137752)
    at Array.Ft (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:10:137551)
    at Array.Ft (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:10:137551)
    at pw (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:9:35342)
    at Array.Wg (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:14:37714)
    at Array.f1 (https://localhost:44301/Scripts/sassjs/0.10.3/sass.worker.js:25:4915)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

It seems to start after attempting to compile invalid css but even when the css is corrected is remains broken. Can you provide any insight?

@rodneyrehm
Copy link
Member

The stack traces of the built file aren't helpful. Can you provide a reduced test case so I can reproduce this in order to investigate?

@jws305
Copy link
Author

jws305 commented Jul 28, 2017

I will try to build one. Is there any way to build the library with the ASSERTIONS=1 flag?

@rodneyrehm
Copy link
Member

closing because there has been no update from OP in months, presume issue is resolved - otherwise please reopen with additional details.

@jailengarcia
Copy link

I'm having this problem, as a work around whenever the compiler fails, I retry with a new instance of the compiler.

@rodneyrehm
Copy link
Member

Sounds like a memory leak problem (that just doesn't matter much on 1-3 compilations).

  • What's the number and size of the files you're trying to compile there?
  • What's the number of compilations before this crash?
  • How are you loading the files? Importer?

@rodneyrehm rodneyrehm reopened this Apr 5, 2018
@jailengarcia
Copy link

It's a single "string" what I'm passing to the compiler, no importer is used. The string size is not bigger that a MB and the number of compilations to the crash goes from 3 to 7.

@rodneyrehm
Copy link
Member

do you mind sharing that source? might be related to functions, loops, …

@jailengarcia
Copy link

jailengarcia commented Apr 5, 2018

The sass looks like:

@function quotes-verbatim($value) {
  @if (type-of($value) == "string") {    
    $list-expr: "#{inspect(($value, ""))}";
    @return str-slice($list-expr, 0, str-length($list-expr) - 4);
  }
  @else {
    @return $value;
  }
}

@function wrap($name, $value) {
  @if (outputstyle() != "COMPRESSED") {
    @if ($value) {
      @return unquote("/* << var:" + $name + " */ " + quotes-verbatim($value) + " /* >> */");
    }
    @return null;
  }
  @return $value;
};

$myBar1: #e23200;
$myBar2: #e23200;
.dummyClass  {
	myBar1: wrap('$myBar1', $myBar1);
	myBar2: wrap('$myBar2', $myBar2);
}

The sequence of var declarations and usage is bigger, around 300. The sass source code is dynamically generated.

@rodneyrehm
Copy link
Member

thanks! I'll investigate once I've managed to switch to WebAssembly and upgraded to libsass 3.5.2 (hopefully soon)

@zenorbi
Copy link

zenorbi commented Sep 20, 2018

I've encountered the same issue, chrome dev tool did show leaking memory and the compiler did crash (aborted) on my sass file after the 48th compile every time. Did a recompilation of sass.js with a newer emscripten and the problem went away. 1000th sass compile and no aborts or memory leaks. The forked repo with the recompiled sass.sync.js: https://github.com/zenorbi/sass.js

@rodneyrehm I can send you a pull request if you'd like to merge the recompiled version.

@rodneyrehm
Copy link
Member

Hey @zenorbi thanks for figuring this out. I've updated my local emscripten installation and ran a new build, released as 0.10.11.

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