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

sassc-2.1.0.pre2 invalid pointer exception #128

Closed
ahorek opened this issue Jun 11, 2019 · 17 comments · Fixed by #130
Closed

sassc-2.1.0.pre2 invalid pointer exception #128

ahorek opened this issue Jun 11, 2019 · 17 comments · Fixed by #130

Comments

@ahorek
Copy link

ahorek commented Jun 11, 2019

I have an error during sass compilation

free(): invalid pointer: 0x00007fe974a7ff00 ***

unfortunately no backtrace or hints where the problem could be.

it does happen only in combination with
pg gem 1.1.4 and sassc-2.1.0.pre2 (precompiled version)

if I build sassc-2.1.0.pre2 from source, it doesn't happen
sassc-2.1.0.pre2 (precompiled) + mysql gem also works fine
so weird...

tried multiple ruby versions without any difference
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
...

the error never occurred to me with prior sassc versions, so it's definitelly related.

Any idea how to debug it further? @glebm
I understand that the error message is quite useless, but I still wanted to report it before the final release.

thanks!

my env

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10+deb8u2' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.2 (Debian 4.9.2-10+deb8u2)
Linux --- 4.9.133-xxxx-std-ipv6-64 #413770 SMP Mon Oct 15 08:12:05 UTC 2018 x86_64 GNU/Linux
@ahorek
Copy link
Author

ahorek commented Jun 11, 2019

investigating...

variables.scss

$gap: 12px !default;
$font-size: 15px !default;
$text-beta: #ae1400 !default;

main.scss

@import "variables";

.management {
  &_indicator {
    margin-right: 4*$gap;
    position: absolute;
    display: inline-block;
    font-size: $font-size;
    color: $text-beta;
    top: 1.75*$gap;
    padding-left: .25*$gap;
  }
}

if I inline variables.scss into main.scss, it works. So it looks like any use of @import triggers the error.

glebm added a commit to glebm/sassc-ruby that referenced this issue Jun 11, 2019
@ahorek
Copy link
Author

ahorek commented Jun 11, 2019

@bolandrm could you share a linux binary built on your environment with debug flags enabled? #129

@glebm
Copy link
Contributor

glebm commented Jun 11, 2019

@ahorek The pre-built binary is built in a Docker container, so everyone should have the same environment.

To build it, simply clone the repo and run bundle exec rake gem:native. It will be in pkg/.

@glebm
Copy link
Contributor

glebm commented Jun 11, 2019

@ahorek You need to have Docker and VirtualBox installed for rake gem:native to work.

@ahorek
Copy link
Author

ahorek commented Jun 11, 2019

ok, I'll try that

@glebm
Copy link
Contributor

glebm commented Jun 11, 2019

Compiled just now with the no-strip patch:

sassc-2.1.0.pre2-x86_64-linux.gem.zip

This was compiled on my Windows machine but that shouldn't matter.

@ahorek
Copy link
Author

ahorek commented Jun 11, 2019

I was able to build #129 according to your manual, however the error remains the same

...
I, [2019-06-12T01:09:17.692716 #2572]  INFO -- : Writing /home/gitlab-runner/test/sassctest/devel/public/assets/asset-3d857124e31be2ed5924711e99957f250e939d51e4c75df19bf6393b1a5cf204.js.gz
*** Error in `ruby /usr/local/rvm/gems/ruby-2.3.3-railsexpress/bin/rake install RAILS_ENV=production --trace': free(): invalid pointer: 0x00007f894ea69f00 ***
Aborted

@glebm
Copy link
Contributor

glebm commented Jun 11, 2019

Perhaps you can try debugging with valgrind?

valgrind --tool=memcheck ./your-command

@glebm
Copy link
Contributor

glebm commented Jun 11, 2019

@ahorek
Copy link
Author

ahorek commented Jun 12, 2019

This looks suspicious:

snipet
==1985== Invalid free() / delete / delete[] / realloc()
==1985==    at 0x4C29AB1: operator delete[](void*) (vg_replace_malloc.c:651)
==1985==    by 0x1A6F5541: std::locale::_Impl::_M_install_facet(std::locale::id const*, std::locale::facet const*) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20)
==1985==    by 0x1A6F59A2: std::locale::_Impl::_Impl(unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20)
==1985==    by 0x1A6F6914: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20)
==1985==    by 0x53D540F: pthread_once (pthread_once.S:103)
==1985==    by 0x1A6F6960: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20)
==1985==    by 0x1A6F69A2: std::locale::locale() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20)
==1985==    by 0x1A73D518: std::basic_filebuf >::basic_filebuf() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20)
==1985==    by 0x197CE2F5: Sass::File::read_file(std::__cxx11::basic_string, std::allocator > const&) (in /usr/local/rvm/gems/ruby-head-opt/gems/sassc-2.1.0.pre2-x86_64-linux/lib/sassc/libsass.so)
==1985==    by 0x1989DA5B: Sass::Context::load_import(Sass::Importer const&, Sass::ParserState) (in /usr/local/rvm/gems/ruby-head-opt/gems/sassc-2.1.0.pre2-x86_64-linux/lib/sassc/libsass.so)
==1985==    by 0x1989E048: Sass::Context::import_url(Sass::Import*, std::__cxx11::basic_string, std::allocator >, std::__cxx11::basic_string, std::allocator > const&) (in /usr/local/rvm/gems/ruby-head-opt/gems/sassc-2.1.0.pre2-x86_64-linux/lib/sassc/libsass.so)
==1985==    by 0x1989F769: Sass::Context::call_loader(std::__cxx11::basic_string, std::allocator > const&, char const*, Sass::ParserState&, Sass::Import*, std::vector >, bool) (in /usr/local/rvm/gems/ruby-head-opt/gems/sassc-2.1.0.pre2-x86_64-linux/lib/sassc/libsass.so)
==1985==  Address 0x1a98ef00 is in the BSS segment of /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20

I'll share a full log soon.

@glebm
Copy link
Contributor

glebm commented Jun 12, 2019

I found a thread on gcchelp about this that seems somewhat related:
https://www.spinics.net/lists/gcchelp/msg46851.html

glebm added a commit to glebm/libsass that referenced this issue Jun 12, 2019
@glebm
Copy link
Contributor

glebm commented Jun 12, 2019

From the gcchelp thread it looks like there is some kind of compatibility issue (bug) with GCC 4/5 and the locale header.

Can you please try with this patch:

glebm/libsass@3b5190a

It avoids initializing locales by using the C API to read files instead of the C++ one.

glebm added a commit to glebm/libsass that referenced this issue Jun 12, 2019
@ahorek
Copy link
Author

ahorek commented Jun 12, 2019

glebm added a commit to glebm/libsass that referenced this issue Jun 12, 2019
@ahorek
Copy link
Author

ahorek commented Jun 12, 2019

thank you @glebm !

I can confirm the patch glebm/libsass@3b5190a fixes the problem. All tests passed.

do we need a new libsass release?

glebm added a commit to glebm/libsass that referenced this issue Jun 12, 2019
glebm added a commit to glebm/libsass that referenced this issue Jun 12, 2019
glebm added a commit to sass/libsass that referenced this issue Jun 12, 2019
glebm added a commit to glebm/sassc-ruby that referenced this issue Jun 12, 2019
The only code change is my hotfix for sass#128

sass/libsass@0328de2

Fixes sass#128
@glebm
Copy link
Contributor

glebm commented Jun 12, 2019

do we need a new libsass release?

Maybe not, sent #130 to build from the right commit.

glebm added a commit to glebm/sassc-ruby that referenced this issue Jun 16, 2019
@bolandrm
Copy link
Member

@ahorek 2.1.0.pre3 released containing this fix

@deepj
Copy link

deepj commented Aug 21, 2019

Unfortunately, I'm getting the same issue with the pointer. sassc 2.1.0 on CentOS 7 with ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]. pg 1.1.4 is used as well.

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

Successfully merging a pull request may close this issue.

4 participants