Open mudge opened 3 years ago
That's odd, as we can see in the C backtrace it's libre2
calling malloc
, so it's hard to understand how TruffleRuby can influence this, but since it passes on CRuby there must be something, maybe in Sulong.
Could you try running on Ubuntu 18.04 or 20.04? 16.04 is quite old. Would also be worth trying TruffleRuby 21.0.0 in CI just to make sure it's not some kind of regression.
@eregon I've now updated the job to run the test suite against truffleruby-21.0.0
and truffleruby-head
on both Ubuntu 18.04 and Ubuntu 20.04.
All combinations still fail but the error messages might be more informative, e.g.
malloc_consolidate(): invalid chunk size
/home/runner/.rubies/truffleruby-head/lib/truffle/truffle/cext.rb:1058:in 'rb_exc_raise': not enough memory to allocate StringPieces for matches (NoMemoryError)
truffleruby: malloc.c:2401: sysmalloc: Assertion '(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
I've also added macOS 10.15 to the build so you can see it passes for both truffleruby-head
and truffleruby-21.0.0
.
For consistency, I've updated the build to test against the same version of the underlying re2 library as the successful macOS job, compiled in the same way as the Homebrew formula (see also https://github.com/mudge/re2-ci/pull/1) and now see the following errors:
I wonder if re2
somehow uses a custom malloc()
or so, which might lead to bad interactions with the default system malloc().
All the errors above are really from some malloc implementation, not from TruffleRuby itself.
I’m not sure if it is relevant but there’s discussion of re2 using a “clever trick” with uninitialized memory (via https://stackoverflow.com/questions/47653565/undefined-behaviour-in-re2-which-stated-to-be-well-defined), specifically in https://github.com/google/re2/blob/master/re2/sparse_array.h and https://github.com/google/re2/blob/master/re2/sparse_set.h
Now on TruffleRuby 24.2.0-dev the specs fail at loading re2.so
(PR):
/home/runner/.rubies/truffleruby-head/bin/truffleruby -I/home/runner/work/re2/re2/vendor/bundle/truffleruby/3.2.2.13/gems/rspec-core-3.13.0/lib:/home/runner/work/re2/re2/vendor/bundle/truffleruby/3.2.2.13/gems/rspec-support-3.13.1/lib /home/runner/work/re2/re2/vendor/bundle/truffleruby/3.2.2.13/gems/rspec-core-3.13.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
[ruby] WARNING the --debug-frozen-string-literal switch is silently ignored as it is an internal development tool
warning: The native extension at /home/runner/.rubies/truffleruby-head/lib/gems/gems/re2-2.12.0-x86_64-linux/lib/3.2/re2.so has a different ABI version: nil than the running TruffleRuby: "3.2.2.13"
An error occurred while loading spec_helper. - Did you mean?
rspec ./spec/spec_helper.rb
Failure/Error: require 're2.so'
LoadError:
cannot load such file -- re2.so
# ./lib/re2.rb:15:in `<top (required)>'
# ./spec/spec_helper.rb:3:in `<top (required)>'
# ------------------
# --- Caused by: ---
# LoadError:
# The native extension at /home/runner/.rubies/truffleruby-head/lib/gems/gems/re2-2.12.0-x86_64-linux/lib/3.2/re2.so has a different ABI version: nil than the running TruffleRuby: "3.2.2.13"
# /home/runner/.rubies/truffleruby-head/lib/truffle/truffle/cext.rb:2[38](https://github.com/andrykonchin/re2/actions/runs/9612453606/job/26513233160?pr=1#step:5:39):in `check_abi_version'
The native extension at /home/runner/.rubies/truffleruby-head/lib/gems/gems/re2-2.12.0-x86_64-linux/lib/3.2/re2.so has a different ABI version: nil than the running TruffleRuby: "3.2.2.13"
Means that the rb_tr_abi_version
symbol/function is not correctly kept in re2.so
.
@gogainda suggested I report the following build error when trying to test re2 against TruffleRuby HEAD:
This is using
ruby/setup-ruby@v1
withtruffleruby-head
onubuntu-16.04
and attempting to run the re2 test suite after compiling it against release 2015-05-01 of the underlying Google re2 library.I've tried this by building every ABI version of
libre2-dev
and tried using the default Ubuntu package for 16.04 but I consistently seemalloc
errors, e.g.memory corruption
:Both seem to refer to the
RE2::Init
function which takes aStringPiece& pattern
andOptions& options
.Strangely, the re2 test suite passes locally on macOS 11.2.1 using
truffleruby
21.0.0 from ruby-build and re2 20210202 from Homebrew: