Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Brunch hangs with sass-brunch 1.8.3 #61

Closed
differentmatt opened this issue Sep 30, 2014 · 16 comments
Closed

Brunch hangs with sass-brunch 1.8.3 #61

differentmatt opened this issue Sep 30, 2014 · 16 comments

Comments

@differentmatt
Copy link

Brunch started sporadically hanging for me after upgrading from sass-brunch 1.7.0 to 1.8.3.

Were there any changes that might cause this behavior?

This is my brunch config:
https://github.com/codecombat/codecombat/blob/master/config.coffee

This is the last thing I see when running brunch --debug:

brunch:pipeline getDependencies 'app/styles/play/world-map-view.sass' with 'SassCompiler' +56ms
brunch:file-list Compiled file 'app/styles/play/world-map-view.sass'... +57ms
@es128
Copy link
Member

es128 commented Sep 30, 2014

Well the major change between those versions is the addition of node-sass, which uses libsass C-bindings under the hood. For .sass files, however, it should still be using the ruby gem like before.

What I find odd about the log messages you pasted is that the file actually did get compiled, so I'm not sure that's really where it's hanging. It might be some other operation that's causing the problem.

Something I have seen before is ruby sass taking a really long time to compile certain files, so you may want to check for any running ruby processes when this happens.

Lastly, what's your brunch --version?

@es128
Copy link
Member

es128 commented Sep 30, 2014

Nevermind about that last question. Obviously latest if you're using --debug

@differentmatt
Copy link
Author

I don't see any ruby processes when the hang happens. Also, we have both .sass and .scss files we're processing in case that could be a problem.

I have the latest node, npm, and sass gem installed.

Failed brunch build:
https://dl.dropboxusercontent.com/u/138899/sass-brunch-1.8.3-hang.txt

Successful brunch build:
https://www.dropbox.com/s/r8n1uewqym42336/sass-brunch-1.8.3-output.txt

@nwinter
Copy link

nwinter commented Sep 30, 2014

On the same project, it hangs for me every time on 1.8.3, but works every time on 1.7.0; it usually works (but is sporadic) on @differentmatt's box. We have the same, latest, versions of everything we can think of: node, npm, brunch, all our node modules, the sass gem... The only difference that comes to mind is that his MacBook is slightly faster than mine.

@es128
Copy link
Member

es128 commented Sep 30, 2014

Try forcing ruby mode (see README) to see if this can be isolated to a problem with libsass.

@nwinter
Copy link

nwinter commented Oct 1, 2014

Unfortunately, that didn't change anything for me; it still hangs.

@es128
Copy link
Member

es128 commented Oct 1, 2014

Just took a look at your log files. After removing the timestamps and sorting the lines, here's the diff. It would appear that the compiler is not returning a result for those 8 files.

@@ -603,6 +603,14 @@
   brunch:file-list Compiled file 'app/styles/play/level/tome/spell_debug.sass'...
   brunch:file-list Compiled file 'app/styles/play/level/tome/spell_list.sass'...
   brunch:file-list Compiled file 'app/styles/play/level/tome/spell_list_entry.sass'...
+  brunch:file-list Compiled file 'app/styles/play/level/tome/spell_list_entry_thangs.sass'...
+  brunch:file-list Compiled file 'app/styles/play/level/tome/spell_palette.sass'...
+  brunch:file-list Compiled file 'app/styles/play/level/tome/spell_palette_entry.sass'...
+  brunch:file-list Compiled file 'app/styles/play/level/tome/spell_toolbar.sass'...
+  brunch:file-list Compiled file 'app/styles/play/level/tome/thang_list.sass'...
+  brunch:file-list Compiled file 'app/styles/play/level/tome/thang_list_entry.sass'...
+  brunch:file-list Compiled file 'app/styles/play/level/tome/thang_list_entry_spells.sass'...
+  brunch:file-list Compiled file 'app/styles/play/level/tome/tome.sass'...
   brunch:file-list Compiled file 'app/styles/play/modal/play-account-modal.sass'...
   brunch:file-list Compiled file 'app/styles/play/modal/play-achievements-modal.sass'...
   brunch:file-list Compiled file 'app/styles/play/modal/play-heroes-modal.sass'...
@@ -4297,6 +4305,14 @@
   brunch:pipeline getDependencies 'app/styles/play/level/tome/spell_debug.sass' with 'SassCompiler'
   brunch:pipeline getDependencies 'app/styles/play/level/tome/spell_list.sass' with 'SassCompiler'
   brunch:pipeline getDependencies 'app/styles/play/level/tome/spell_list_entry.sass' with 'SassCompiler'
+  brunch:pipeline getDependencies 'app/styles/play/level/tome/spell_list_entry_thangs.sass' with 'SassCompiler'
+  brunch:pipeline getDependencies 'app/styles/play/level/tome/spell_palette.sass' with 'SassCompiler'
+  brunch:pipeline getDependencies 'app/styles/play/level/tome/spell_palette_entry.sass' with 'SassCompiler'
+  brunch:pipeline getDependencies 'app/styles/play/level/tome/spell_toolbar.sass' with 'SassCompiler'
+  brunch:pipeline getDependencies 'app/styles/play/level/tome/thang_list.sass' with 'SassCompiler'
+  brunch:pipeline getDependencies 'app/styles/play/level/tome/thang_list_entry.sass' with 'SassCompiler'
+  brunch:pipeline getDependencies 'app/styles/play/level/tome/thang_list_entry_spells.sass' with 'SassCompiler'
+  brunch:pipeline getDependencies 'app/styles/play/level/tome/tome.sass' with 'SassCompiler'
   brunch:pipeline getDependencies 'app/styles/play/modal/play-account-modal.sass' with 'SassCompiler'
   brunch:pipeline getDependencies 'app/styles/play/modal/play-achievements-modal.sass' with 'SassCompiler'
   brunch:pipeline getDependencies 'app/styles/play/modal/play-heroes-modal.sass' with 'SassCompiler'
@@ -5879,7 +5895,6 @@
   brunch:watch File 'app/assets/images/pages/contribute' received event 'addDir'
   brunch:watch File 'app/assets/images/pages/contribute/adventurer.png' received event 'add'
   brunch:watch File 'app/assets/images/pages/contribute/ambassador.png' received event 'add'
-  brunch:watch File 'app/assets/images/pages/contribute/archmage' received event 'addDir'
   brunch:watch File 'app/assets/images/pages/contribute/archmage.png' received event 'add'
   brunch:watch File 'app/assets/images/pages/contribute/artisan.png' received event 'add'
   brunch:watch File 'app/assets/images/pages/contribute/contribute_header.png' received event 'add'
@@ -7051,4 +7066,4 @@
   brunch:watch File 'vendor/styles/jasmine.css' received event 'add'
   brunch:watch File 'vendor/styles/jquery-ui-1.11.1.custom.css' received event 'add'
   brunch:watch File 'vendor/styles/jquery.minicolors.css' received event 'add'
-Nick:coco winter$ brunch b --debug
+16:03:14:~/GitHub/codecombat$ brunch b --debug

Another change between versions of the plugin is that the ruby compilation has moved to a promise implementation. I wonder if the spawn is failing silently because it's hitting the sass gem too fast, or something like that.

@es128
Copy link
Member

es128 commented Oct 1, 2014

Just published 1.8.4 of the plugin with an allowCache option. May substantially help with a project of this size. Please give it a try and let me know.

@es128
Copy link
Member

es128 commented Oct 1, 2014

By the way, it would be awesome if you folks could add codecombat to http://brunch.io/examples.html.

https://github.com/brunch/brunch.github.io/blob/brunch/app/_includes/examples.html

@es128
Copy link
Member

es128 commented Oct 1, 2014

I cloned the project and re-installed the latest sass-brunch to give it a shot, and haven't been able to reproduce the issue on my machine. I also tried turning on the allowCache option, which shaves a few seconds off the compile time.

@nwinter
Copy link

nwinter commented Oct 1, 2014

I've grabbed the latest sass-brunch and turned on allowCache (and with/without ruby mode), and I'm still seeing the problem. I'm going to try upgrading my OS to Yosemite next, since I have to do that anyway, and maybe it'll reset any weird issues I have.

Sure, I'll do the brunch example addition when I have a moment.

@es128
Copy link
Member

es128 commented Oct 1, 2014

I just updated my sass gem to latest (3.4.5), and now I can reproduce the problem. I had been on 3.2.12 before.

@differentmatt
Copy link
Author

I was able to downgrade to sass gem 3.2.12 and successfully build with sass-brunch 1.8.4. So, as an interim solution we could use this older version of sass until we figure out why the latest toolsets are busted.

@nwinter or @schmatz, how would we ensure we have a specific version of the sass gem in production?

@differentmatt
Copy link
Author

@es128 Did something change between sass-brunch 1.7.0 and 1.7.2 to handle nested @media?

Using sass 3.2.12 ended up having the same problem for me, somewhat inconsistently.

However, it looks like we only need sass-brunch 1.7.2 in order to get bless-brunch correctly splitting up our css files (for IE9 support). I originally upgraded sass-brunch to 1.8.3 so that nested @media queries would be properly unrolled (sass 3.1.0 change).

There still seems to be a build hang problem, but it's unclear to me whether it lies with sass or sass-brunch. Inconsistent repros across machines makes this difficult to investigate. E.g. my old windows 8.1 box builds fine with the latest of each tool, while my new macbook has problems only sometimes.

@es128
Copy link
Member

es128 commented Oct 3, 2014

No, the plugin does not address compiler handing of things like nested @media. Nor does it influence the version of the sass gem.

As for the hanging problem, the underlying issue is most likely with sass itself hanging and neither returning a result nor an error. Brunch invokes a separate instance for each source file nearly simultaneously, so it seems likely that there's a concurrency bug in there somewhere, perhaps having to do with shared dependencies. As for the issue only manifesting with sass-brunch 1.8.x, I think the method of invoking the compiler is now more optimized, making the concurrency issue more likely to manifest.

That said, sass-brunch could probably be made to detect that the child process failed to return a result and handle it more gracefully.

@differentmatt
Copy link
Author

Leaving this build hang mystery unsolved for now, and closing since it's not clearly a sass-brunch problem.

Thanks for all the info and debugging help!

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

No branches or pull requests

3 participants