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

malloc crash #104

Closed
aleemb opened this issue Oct 18, 2014 · 20 comments
Closed

malloc crash #104

aleemb opened this issue Oct 18, 2014 · 20 comments
Labels

Comments

@aleemb
Copy link

aleemb commented Oct 18, 2014

I updated recently to 1.10 and ran into this issue

gulp(1166,0x7fff7db64310) malloc: *** error for object 0x1044a9d3d: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

Shortly there after, a day later 1.20 was released and I upgraded to that but still run into the same error. Is there something I can do to remedy this?

I am calling sass() without any options.

@aleemb
Copy link
Author

aleemb commented Oct 18, 2014

So this issue is happening due to a strange corner case. I had the following files:

foo\_vars.scss
foo\foo.scss
bar\_vars.scss
bar\bar.scss

with the contents:

// bar/bar.scss
@import 'vars'
// ...
// foo/foo.scss
@import 'vars'
@import '../bar/bar'

The issue during the compilation of foo.scss was that when bar/bar.scss was importing vars, it was doing so from it's the foo folder and this led to strange behaviour. I renamed the import to @import '_vars' and things started working again but after upgrading to 1.10 this started to crash (on osx, but still worked on Windows with 1.10).

Anyway, the workaround is to rename foo/vars.scss to something else.

However, I am not sure if this can still be considered a bug. The ruby sass compiler didn't choke on this.

@bmwertman
Copy link

I'm getting the same error message. I just have a folder of empty .scss files I'm passing to gulp.

The file structure looks like this:

gulpfile.js/
    gulp.task('styles', function () {
     gulp.src('./foo/bar/*.scss')
         .pipe(sass())
         .pipe(gulp.dest('./www/css'));
     });
foo/
    bar/
        fileA.scss
        fileB.scss
        fileC.scss
        ....

@MethodGrab
Copy link
Contributor

I have this problem as well.
A single line break or empty comment // in the .scss file is enough to avoid the error but a completely empty .scss file will break with this memory error.

Tested against gulp-sass master (ca6a21c) with node-sass v1.0.3

@voldmar
Copy link

voldmar commented Oct 28, 2014

I just found that this error occurs when I have empty .scss files

@bmwertman
Copy link

@MethodGrab and @voldmar,

That was it. Just setting up my file structure and had thrown a bunch of empty .scss files in my styles folder. The // in each folder was enough to lose the error!

Thanks

@micahlmartin
Copy link

I can also confirm this happens with an empty file. Adding a line break fixes it.

@scottymeyers
Copy link

In the midst of making changes to a .scss file, when I save occasionally the file is emptied and I receive this error..

@barnomics
Copy link

I'm getting this error but none of my .scss files are not empty. What gives?

@bmwertman
Copy link

You used a double negative. Do you mean all of your .scss files have
content or they are all empty?
On Nov 5, 2014 12:53 PM, "Bar" notifications@github.com wrote:

I'm getting this error but none of my .scss files are not empty. What
gives?


Reply to this email directly or view it on GitHub
#104 (comment).

@barnomics
Copy link

Sorry! All of my files have content in them - none are blank.

If i remove all of the .scss files from the directory, one at a time, it will crash each time.

@dlmanning
Copy link
Owner

malloc crashes are happening at the C layer, and so should be reported either to nodesass or libsass

@leehambley
Copy link

malloc crashes are happening at the C layer, and so should be reported either to nodesass or libsass

Does anyone happen to know if this was already reported, or if there is documentation for how to provide a more complete test-case, and I'll be more than happy to submit the issues upstream. (I couldn't find anything)

@MethodGrab
Copy link
Contributor

@leehambley, it's been reported here: sass/node-sass#554

@leehambley
Copy link

Thanks @MethodGrab, interesting reading!

@DrummerHead
Copy link

For reference, I also had this error. My problem was that I missed some ;s at the end of @import statements in main.scss. Adding these solved the issue. Cheers!

@xzyfer
Copy link
Collaborator

xzyfer commented Dec 3, 2015

If you could supply a piece of Sass code that produced a malloc due to malformed @import that would be hugely useful.

@DrummerHead
Copy link

@xzyfer Of course! I created a repo with an isolated case that you can use for debugging at:

https://github.com/DrummerHead/sass-malloc-error

Cheers!

@xzyfer xzyfer reopened this Dec 10, 2015
@xzyfer
Copy link
Collaborator

xzyfer commented Dec 10, 2015

Thanks @DrummerHead this is perfect.

@xzyfer
Copy link
Collaborator

xzyfer commented May 10, 2016

I've managed to get back around to this. This issue appears to have been fixed in successive node-sass releases.

@xzyfer xzyfer closed this as completed May 10, 2016
@jakeNiemiec
Copy link

jakeNiemiec commented Mar 12, 2018

This happened for me recently after upgrade, fix: rm -rf ./node_modules && npm cache clean --force && npm rebuild

I had to downgrade to 4.7.2

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

No branches or pull requests