Merged
Conversation
The differences between Ruby 2 and Ruby 3 are significant in terms of thread safety and memory safety. I (Cal) have not worked with the Ruby SDK very much in the past. There is not much documentation for C++ embedders to use, especially concerning the newer Ruby versions. So I decided to try out OpenAI's Codex CLI. I gave it access to all of Ruby 3.2's source and headers, along with a mechanism to compile and test ModRuby on a live Apache server. I showed it the segfault back trace in rb_protect() and told it to resolve the issue. It spent a total of around an hour doing web searches, reading the source and trying things out. It made mistakes, spotted its own errors, then recompiled and retested until it had success. I've scanned over this commit and I don't see any obvious problems with it. There were two main issues here for the Ruby 3 port: 1) You can't call rb_protect() without a global VM lock 2) You can't get the global VM lock from a thread outside of Ruby (IE: In an Apache MPM thread) Fixing #1 caused #2. The RubyDispatcher class shifts interaction with Ruby to an interface that manages the global VM. rb_protect() is wrapped in a GVL so that native C++ functions can interact with Ruby objects and methods.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.