sass / sassc-ruby

Use libsass with Ruby!
MIT License
367 stars 156 forks source link

Weird mixin SCSS causes massive memory leak #201

Closed MattReimer closed 4 years ago

MattReimer commented 4 years ago

Let's start by saying this is a difficult issue to report on. I filed it with the foundation-sites folks and they're pretty confident it's a bug in sassc. I'm no ruby expert but I think that there's no situation under which this library should take more than 50Gb of memory so hopefully I can find a home for this issue without too much back and forth.


What should happen?

When I use jekyll to build the scss for foundation-sites the the memory consumption swells to 50+Gb unless I comment out a chunk of the @mixin foundation-button-group

When I comment out these lines it works. I'm not really a SASS expert so I don't know what to suggest. I only found this by commenting out everything and bringing things back until it compiled.

My Environment:

OSX 10.15.4 Ruby: ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]

Foundation installed with NPM, copied over to Jekyll's _sass folder.

foundation-sites@6.6.3:
  version "6.6.3"
  resolved "https://registry.yarnpkg.com/foundation-sites/-/foundation-sites-6.6.3.tgz#8ca5f246357db69e6a0e73351ce06aa8acce6540"
  integrity sha512-8X93wUAmUg1HhVv8uWMWnwoBLSQWSmFImJencneIZDctswn724Bq/MV1cbPZN/GFWGOB/9ngoQHztfzd4+ovCg==

Compiling SCSS using jekyll 4.0 and sassc

From my Gemfile.lock

    jekyll (4.0.0)
      addressable (~> 2.4)
      colorator (~> 1.0)
      em-websocket (~> 0.5)
      i18n (>= 0.9.5, < 2)
      jekyll-sass-converter (~> 2.0)
      jekyll-watch (~> 2.0)
      kramdown (~> 2.1)
      kramdown-parser-gfm (~> 1.0)
      liquid (~> 4.0)
      mercenary (~> 0.3.3)
      pathutil (~> 0.9)
      rouge (~> 3.0)
      safe_yaml (~> 1.0)
      terminal-table (~> 1.8)
    jekyll-sass-converter (2.1.0)
      sassc (> 2.0.1, < 3.0)
    sassc (2.3.0)
      ffi (~> 1.9)

Reproducing

I've got a repo that shows the problem here (dev branch):

https://github.com/Riverscapes/riverscapes-jekyll-theme/tree/dev

Repro steps:

  1. clone the repo
  2. Uncomment the following lines: https://github.com/Riverscapes/riverscapes-jekyll-theme/blob/dev/_sass/foundation-sites/scss/components/_button-group.scss#L236-L252
  3. Run bundle install
  4. Run bundle exec jekyll server --verbose

Watch memory consumption go BOOM!

Screen Shot 2020-05-05 at 5 49 33 PM
ahorek commented 4 years ago

I can confirm that https://github.com/sass/sassc-ruby/pull/199 fixes the issue

MattReimer commented 4 years ago

This looks good to me too. Thanks for: https://github.com/Riverscapes/riverscapes-jekyll-theme/pull/15