-
Notifications
You must be signed in to change notification settings - Fork 63
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
Fix test issues on Ruby 3.4 #242
Conversation
Notes: This is not a new error, the current release also fails in this way. It's also not all tests, and we call |
Can you split this into 2 different PRs because I think there are 2 different issues. One is an embedding issue, one is a GC issue. The first is that on 3.4 embedding Ruby fails. See for example: https://github.com/ruby-rice/rice/actions/runs/12534403540/job/35007888873 In cases where the tests do run (just Fedora for me locally), then a GC bug happens (which sounds like what you are seeing). Pretty sure that is a new bug, and pretty sure that is a Ruby bug. When I looked at it, the problem is that Ruby is not calling the mark function when it should be. I would not comment out the GC calls because that is just hiding the problem instead of solving it. |
Sorry should have been clearer about the purpose of this. I don't intend on merging this, I just wanted a place to show code changes that at least get us passed the segfaults, to see if something showed up that may help track down what's actually failing. |
Well I have a minimal reproducible example: #include <ruby.h>
int main(int argc, char** argv)
{
ruby_init();
ruby_init_loadpath();
char* options[] = { "-e;" };
ruby_options(2, options);
} And a build script: #!/bin/bash
set -ex
PREFIX=[where ruby is installed]
clang++ -I$PREFIX/include/ruby-3.4.0/arm64-darwin24 -I$PREFIX/include/ruby-3.4.0 -L$PREFIX/lib -lruby.3.4 test.cpp |
That script causes the crash? The test code includes a call to https://github.com/ruby-rice/rice/blob/master/test/embed_ruby.cpp#L14 |
Yeah crashes with or without
|
Best I've tracked down so far: something is getting read into a global setting (such as |
So I was making zero progress and things were just weird. Then I pulled up Ruby's own https://github.com/ruby/ruby/blob/v3_4_1/include/ruby/internal/interpreter.h#L127-L144 With that call, my test script no longer segfaults. And neither does CI, just a few actual 3.4 related test failures. |
Given the documentation of |
Wow - nice work! Funny the new test failures in stl_map. Looks like Windows is crashing right after the |
Aparently Hash#to_s formatting changed with Ruby 3.4 so we need to track that now.
Error message formatting got rid of the backtick.
`rake test` depends on `rake build` and CI was then triggering the full rebuild twice.
b6dcaf2
to
3dbcaa1
Compare
The current windows-latest runners are unbelievably slow.
The Windows runners are awful, but tests are passing (Windows apparently still needs the |
Cool. Its also easy for me to test windows locally (both mswin and mingw). |
This PR fixes up the test problems we were seeing under Ruby 3.4. The main issue was the lack of
RUBY_INIT_STACK
which has existed for a long time but looks like for Ruby 3.4 is now definitely needed. The lack of this call inembed_ruby.cpp
was leading to very strange and inconsistent GC-related errors.