`Gem::Version.new`, `#bump`, and `#release` do not work in ractor

オープン
#9,964 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@mmporong がすでに取り組んでいます。

2026年10月27日 から。

  • #9977 @mmporong による — オープン

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
ruby
領域
tooling

調査の方向性

Start with lib/rubygems/version.rb, especially Gem::Version.new, #bump, and #release, and review how their class variables are used. Reproduce the reported Ractor::IsolationError in a non-main Ractor, then add or update the relevant RubyGems tests to cover those methods in Ractors. Done means the methods work in the reported Ractor scenarios without the class-variable isolation error, with focused tests passing.

索引モデルが issue の本文から書いたものです。

説明

RubyGems

reproduction:

Gem::VERSION # => "4.0.23"

Ractor.new { Gem::Version.new(1) }
# => #<Thread:0x0000000122ea71d0 run> terminated with exception (report_on_exception is true):
# => ~/.asdf/installs/ruby/4.0/lib/ruby/4.0.0/rubygems/version.rb:201:in 'Gem::Version.new':
# => can not access class variables from non-main Ractors (@@all from Gem::Version) (Ractor::IsolationError)

relevant code: https://github.com/ruby/rubygems/blob/f033df93676007227d1ae0bd7326008e6396b3e9/lib/rubygems/version.rb#L212-L220

i guess this hasn't become apparent yet because gem versions are usually initialized at load-time? it could, however, be an issue for a few gems that do things like if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0') at runtime.

same for #bump and #release:

Ractor.new(Gem::Version.new(1), &:bump)
# => #<Thread:0x00000001206e3658 run> terminated with exception (report_on_exception is true):
# => ~/.asdf/installs/ruby/4.0/lib/ruby/site_ruby/4.0.0/rubygems/version.rb:236:in 'Gem::Version#bump':
# => can not access class variables from non-main Ractors (@@bump from Gem::Version) (Ractor::IsolationError)

Ractor.new(Gem::Version.new(1), &:release)
# => #<Thread:0x00000001206c0b80 run> terminated with exception (report_on_exception is true):
# => ~/.asdf/installs/ruby/4.0/lib/ruby/site_ruby/4.0.0/rubygems/version.rb:314:in 'Gem::Version#release':
# => can not access class variables from non-main Ractors (@@release from Gem::Version) (Ractor::IsolationError)
主要言語
Ruby
スター
4k
フォーク
2k
平均マージ
1日 11時間
マージ済み PR(30日)
48

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ruby/rubygems のほかの issue

ruby/rubygems の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。