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

Core Dump using jRuby with sassc 2.4.0 #208

Closed
jboler opened this issue Jul 2, 2020 · 7 comments
Closed

Core Dump using jRuby with sassc 2.4.0 #208

jboler opened this issue Jul 2, 2020 · 7 comments

Comments

@jboler
Copy link

jboler commented Jul 2, 2020

Happens on Mac & Linux with jRuby & sassc v2.4.0. It doesn't happen with v2.3.0.

Haven't tested MRI.

Error in `/usr/local/lib/jvm/openjdk11/bin/java': double free or corruption (out): 0x00007fb7489170e0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fb77efce7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fb77efd737a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fb77efdb53c]
[0x7fb760c67890]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:01 791938                             /usr/local/lib/jvm/openjdk11/bin/java
00600000-00601000 r--p 00000000 08:01 791938                             /usr/local/lib/jvm/openjdk11/bin/java
00601000-00602000 rw-p 00001000 08:01 791938                             /usr/local/lib/jvm/openjdk11/bin/java
01d5f000-01d80000 rw-p 00000000 00:00 0                                  [heap]
...
7fb71e3f7000-7fb71e985000 r-xp 00000000 08:01 2315350                    /home/travis/.rvm/gems/jruby-9.2.11.0/gems/sassc-2.4.0/lib/sassc/libsass.so
7fb71e985000-7fb71eb85000 ---p 0058e000 08:01 2315350                    /home/travis/.rvm/gems/jruby-9.2.11.0/gems/sassc-2.4.0/lib/sassc/libsass.so
7fb71eb85000-7fb71eb94000 r--p 0058e000 08:01 2315350                    /home/travis/.rvm/gems/jruby-9.2.11.0/gems/sassc-2.4.0/lib/sassc/libsass.so
7fb71eb94000-7fb71ebab000 rw-p 0059d000 08:01 2315350                    /home/travis/.rvm/gems/jruby-9.2.11.0/gems/sassc-2.4.0/lib/sassc/libsass.so
...
@headius
Copy link

headius commented Jul 16, 2020

This may be related to jruby/jruby#6310.

I have not done any investigation to know whether this is a sassc problem or a JRuby FFI problem, but we have no other known issues with double-freeing in JRuby FFI.

@headius
Copy link

headius commented Jul 16, 2020

@jboler Do you have an easy way to reproduce this?

headius added a commit to headius/jruby that referenced this issue Jul 16, 2020
This appears to be long-broken logic for setting autorelease to
false, since the only value that will change the unmanaged bit is
passing autorelease = true. The change here allows toggling both
ways.

This may not have been seen before because this version of
MemoryIO is only used when the requested size is greater than 256
bytes, and typically structs are smaller than that. In jruby#6284, as
well as jruby#6310 and sass/sassc-ruby#208, we have reports of a double
free, and sassc itself uses autorelease on a potentially large
value here:

https://github.com/sass/sassc-ruby/blob/4bd764f568ad312a78181d7a3187f3715388e33e/lib/sassc/native.rb#L54-L58
@headius
Copy link

headius commented Jul 16, 2020

This may be fixed by jruby/jruby#6331 but I do not have a way to reproduce or test... @jboler help!

@headius
Copy link

headius commented Jul 16, 2020

It looks as though jruby/jruby#6331 does indeed fix this issue. It will be released in JRuby 9.2.13.

@jboler
Copy link
Author

jboler commented Jul 20, 2020

I can reproduce it locally but I haven't tracked it down to a minimal case that I can upload. Is there a way to install a pre-release build of 9.2.13 to test it?

@headius
Copy link

headius commented Jul 21, 2020

@jboler We have one confirmation that it is fixed in the 9.2.13.0 snapshots, but more confirmation is good!

You can download a tarball from here: https://oss.sonatype.org/content/repositories/snapshots/org/jruby/jruby-dist/9.2.13.0-SNAPSHOT/

@jboler
Copy link
Author

jboler commented Aug 11, 2020

Confirmed as fixed in jRuby 9.2.13.0

@jboler jboler closed this as completed Aug 11, 2020
enebo pushed a commit to jruby/jruby that referenced this issue Aug 31, 2020
This appears to be long-broken logic for setting autorelease to
false, since the only value that will change the unmanaged bit is
passing autorelease = true. The change here allows toggling both
ways.

This may not have been seen before because this version of
MemoryIO is only used when the requested size is greater than 256
bytes, and typically structs are smaller than that. In #6284, as
well as #6310 and sass/sassc-ruby#208, we have reports of a double
free, and sassc itself uses autorelease on a potentially large
value here:

https://github.com/sass/sassc-ruby/blob/4bd764f568ad312a78181d7a3187f3715388e33e/lib/sassc/native.rb#L54-L58
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

No branches or pull requests

2 participants