Skip to content

[pull] master from ruby:master#1012

Merged
pull[bot] merged 7 commits into
turkdevops:masterfrom
ruby:master
May 14, 2026
Merged

[pull] master from ruby:master#1012
pull[bot] merged 7 commits into
turkdevops:masterfrom
ruby:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 14, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

st0012 and others added 7 commits May 14, 2026 15:21
rb_gc_initialize_vm_context calls GET_EC, which does VM_ASSERT(ec !=
NULL).

When Ruby is built with RUBY_DEBUG=1 and GC stress is set to run at boot
with RUBY_DEBUG=gc_stress then GC gets run inside Init_BareVM when we're
setting up the main_thread.

In gc_start we gate the GC with some early returns that prevent us
actually attempting a GC if the heap and objspace are not ready yet, but
we're attempting to initialize the gc's VM context before those gates,
causing the assertion to fail (because the VM isn't ready yet).

This commit moves the vm_context setup after the gates, so we don't
attempt it before objspace and the heap are fully set up.

To repro this bug configure with --enable-dev-env and
cflags=-DRUBY_DEBUG and then run

RUBY_DEBUG=gc_stress ./ruby -v
The GC RUBY_DEBUG=gc_stress bug should have been caught by
test_gc_stress_at_startup, but because RUBY_DEBUG has been ignored on
CI, the subprocess wasn't actually running stress at startup
```
../test/ruby/test_class.rb:445: warning: already initialized constant TestClass::CloneTest1::TEST
../test/ruby/test_class.rb:438: warning: previous definition of TEST was here
../test/ruby/test_class.rb:448: warning: already initialized constant TestClass::CloneTest2::TEST
../test/ruby/test_class.rb:438: warning: previous definition of TEST was here
```
@pull pull Bot locked and limited conversation to collaborators May 14, 2026
@pull pull Bot added the ⤵️ pull label May 14, 2026
@pull pull Bot merged commit 5a03fcb into turkdevops:master May 14, 2026
1 of 3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants