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

Aperta
#9,964 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@mmporong ci sta già lavorando.

Dal 27/10/2026.

  • #9977 di @mmporong — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
ruby
Ambito
tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)
Lingua principale
Ruby
Stelle
4k
Fork
2k
Merge medio
1g 5h
PR unite (30g)
36

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ruby/rubygems

Tutte le issue di ruby/rubygems

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.