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

Hanging with 3.6.2 when generating breeze-gtk (worked with 3.6.1) #3006

Closed
heirecka opened this issue Oct 17, 2019 · 7 comments · Fixed by #3007
Closed

Hanging with 3.6.2 when generating breeze-gtk (worked with 3.6.1) #3006

heirecka opened this issue Oct 17, 2019 · 7 comments · Fixed by #3007

Comments

@heirecka
Copy link

heirecka commented Oct 17, 2019

input.scss

split into multiple files: https://cgit.kde.org/breeze-gtk.git/tree/src

invocation of sassc via

CMakeLists.txt

...
add_custom_command(
    OUTPUT ${Breeze_TARGETS}
    DEPENDS ${SOURCES}
    COMMAND ./build_theme.sh -c Breeze -t "${PROJECT_BINARY_DIR}/Breeze" -r "${BREEZE_COLOR_INSTALL_ROOT}"
    COMMAND cp gtk-dark-3.0.css "${PROJECT_BINARY_DIR}/Breeze/gtk-3.0/gtk-dark.css"
    WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/src"
)
...

build_theme.sh

...
# Usage: build_sass <source-directory> <target-directory> <include-directory>
build_sass() {
  if command -v sassc >/dev/null 2>&1; then
      sassc -I "$3" "$1" "$2"
  else
      sass -I "$3" --cache-location /tmp/sass-cache "$1" "$2"
  fi
}
...

Actual results

Hangs indefinitely

version info:

$ sassc -v
sassc: na
libsass: na
sass2scss: 1.1.1
sass: 3.5

Have to check where the "na" comes from but it is 3.6.2 (sassc-3.6.1) built from a tarball (I guess the information from git might be missing there).

Expected result

Passing just fine as with 3.6.1

version info:

sassc -v
sassc: na
libsass: na
sass2scss: 1.1.1
sass: 3.5

actually libsass-3.6.1 / sassc 3.6.1

Backtrace

I attached gdb:

(gdb) bt
#0  0x00007f59714be861 in Sass::SharedPtr::incRefCount (this=0x7fffc1a2ba08) at memory/SharedPtr.hpp:174
#1  Sass::SharedPtr::SharedPtr (ptr=0x556ce0e3b660, this=0x7fffc1a2ba08) at memory/SharedPtr.hpp:114
#2  Sass::SharedPtr::SharedPtr (obj=..., this=0x7fffc1a2ba08) at memory/SharedPtr.hpp:116
#3  Sass::SharedImpl<Sass::SelectorComponent>::SharedImpl (this=0x7fffc1a2ba08) at memory/SharedPtr.hpp:183
#4  Sass::ComplexSelector::minSpecificity (this=this@entry=0x556ce0e60820) at ast_selectors.cpp:843
#5  0x00007f5971593662 in Sass::Extender::dontTrimComplex (complex2=0x556ce0e60820, complex1=0x556ce0e60820, maxSpecificity=2002) at extender.cpp:1163
#6  0x00007f597159390b in Sass::hasAny<std::vector<Sass::SharedImpl<Sass::ComplexSelector>, std::allocator<Sass::SharedImpl<Sass::ComplexSelector> > >, bool (*)(Sass::ComplexSelector const*, Sass::ComplexSelector const*, unsigned long), Sass::SharedImpl<Sass::ComplexSelector>, unsigned long> (
    fn=0x7f5971593650 <Sass::Extender::dontTrimComplex(Sass::ComplexSelector const*, Sass::ComplexSelector const*, unsigned long)>, 
    cnt=std::vector of length 38733, capacity 65536 = {...}) at memory/SharedPtr.hpp:215
#7  Sass::Extender::trim (this=0x556ce0a66f88, selectors=std::vector of length 77, capacity 128 = {...}, 
    existing=std::unordered_set with 187 elements = {...}) at extender.cpp:1109
#8  0x00007f5971593c7d in Sass::Extender::extendList (this=0x556ce0a66f88, list=..., extensions=std::unordered_map with 6 elements = {...}, 
    mediaQueryContext=...) at memory/SharedPtr.hpp:147
#9  0x00007f59715984dc in Sass::Extender::addSelector (this=0x556ce0a66f88, selector=..., mediaContext=...) at extender.cpp:186
#10 0x00007f5971585674 in Sass::Expand::operator() (this=0x7fffc1a2ca70, r=0x556ce0b31fe0)
    at /usr/x86_64-pc-linux-gnu/include/c++/9.2.0/bits/stl_iterator.h:867
#11 0x00007f5971587d93 in Sass::Expand::append_block (this=this@entry=0x7fffc1a2ca70, b=b@entry=0x556ce0b319e0) at expand.cpp:846
#12 0x00007f5971580e05 in Sass::Expand::operator() (this=0x7fffc1a2ca70, b=0x556ce0b319e0) at expand.cpp:140
#13 0x00007f59715856bf in Sass::Expand::operator() (this=0x7fffc1a2ca70, r=0x556ce0b31450) at memory/SharedPtr.hpp:175
#14 0x00007f5971587d93 in Sass::Expand::append_block (this=this@entry=0x7fffc1a2ca70, b=b@entry=0x556ce0b33e60) at expand.cpp:846
#15 0x00007f5971580e05 in Sass::Expand::operator() (this=0x7fffc1a2ca70, b=0x556ce0b33e60) at expand.cpp:140
#16 0x00007f597157f05a in Sass::Expand::operator() (this=0x7fffc1a2ca70, a=0x556ce0b33f20) at memory/SharedPtr.hpp:147
#17 0x00007f5971587d93 in Sass::Expand::append_block (this=this@entry=0x7fffc1a2ca70, b=b@entry=0x556ce0b30bd0) at expand.cpp:846
#18 0x00007f5971580e05 in Sass::Expand::operator() (this=0x7fffc1a2ca70, b=0x556ce0b30bd0) at expand.cpp:140
#19 0x00007f59715856bf in Sass::Expand::operator() (this=0x7fffc1a2ca70, r=0x556ce0b30810) at memory/SharedPtr.hpp:175
#20 0x00007f5971587d93 in Sass::Expand::append_block (this=this@entry=0x7fffc1a2ca70, b=0x556ce0b03550) at expand.cpp:846
#21 0x00007f5971584486 in Sass::Expand::operator() (this=0x7fffc1a2ca70, i=<optimized out>) at memory/SharedPtr.hpp:215
#22 0x00007f5971587d93 in Sass::Expand::append_block (this=this@entry=0x7fffc1a2ca70, b=b@entry=0x556ce0a68070) at expand.cpp:846
#23 0x00007f5971580e05 in Sass::Expand::operator() (this=this@entry=0x7fffc1a2ca70, b=0x556ce0a68070) at expand.cpp:140
#24 0x00007f59714cbda2 in Sass::Context::compile (this=0x556ce0a66d10) at memory/SharedPtr.hpp:215
#25 0x00007f59714ce0c9 in Sass::File_Context::parse (this=0x556ce0a66d10) at context.cpp:579
#26 0x00007f59715b2c57 in Sass::sass_parse_block (compiler=0x556ce0a67690) at sass_context.cpp:180
#27 sass_compiler_parse (compiler=0x556ce0a67690) at sass_context.cpp:434
#28 sass_compiler_parse (compiler=0x556ce0a67690) at sass_context.cpp:424
#29 0x00007f59715b3059 in sass_compile_context (c_ctx=0x556ce0a66bc0, cpp_ctx=<optimized out>) at sass_context.cpp:317
#30 0x0000556cdf940616 in compile_file ()
#31 0x0000556cdf9400dd in main ()

edit: added backtrace with debug symbols

@saper
Copy link
Member

saper commented Oct 17, 2019

Could this be related to #2995 ?

@mgreter
Copy link
Contributor

mgreter commented Oct 18, 2019

This is a different issue, although in the same loop.
Unfortunately dart-sass loop hasn't a clear abort condition either.

.view:focus, .view {
  @extend %selected_items;
}

%selected_items {
    &:backdrop {
      foo: bar;
    }
}

@hedning hedning mentioned this issue Oct 18, 2019
10 tasks
FRidh added a commit to NixOS/nixpkgs that referenced this issue Oct 18, 2019
This hangs when generating gtk3 templates.
sass/libsass#3006

This reverts commit e4b4ff8.
mgreter added a commit to mgreter/libsass that referenced this issue Oct 18, 2019
@mgreter mgreter self-assigned this Oct 18, 2019
mgreter added a commit to mgreter/libsass that referenced this issue Oct 18, 2019
@mgreter
Copy link
Contributor

mgreter commented Oct 20, 2019

Seems the code base exposes another uncovered issue:

.class, .class {
  tag {
      @extend tag;
  }
}

@mgreter
Copy link
Contributor

mgreter commented Oct 20, 2019

Btw. @heirecka did you try to compile it with dart-sass. It seems to trigger also an endless loop on my machine. With the two fixes from #3007 it seems to compile, but the breeze code (headerbar) seems to bring the extend algorithm to its knees :)

Note: it does compile with dart sass but seems to take around 10 minutes ...

@heirecka
Copy link
Author

With the two fixes it works (haven't measured anything, but it seems a bit slower than 3.6.1 and memory usage spikes + ~ 1 GB - not complaing just an obversation). Thanks!

With dart-sass (the version npm fetched me) I get "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" after some quite some time (and after fixing the extend compound warnings, which I need to upstream).

@mgreter
Copy link
Contributor

mgreter commented Oct 21, 2019

Thanks for checking. I believe dart-sass used more than 4GB of RAM when I tested it.
On another note, are you sure you really want to extend * two times?
Without these the compile is pretty much instant.

@heirecka
Copy link
Author

To be honest, I know very little about the code in question. I mostly got into this because I was trying to update the libsass package of my distro. But I'll try to poke some people who know more about this.

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

Successfully merging a pull request may close this issue.

3 participants