Skip to content

Mark extension as Ractor-safe - #3491

Merged
kddnewton merged 1 commit into
mainfrom
mark-as-ractor-safe
Mar 12, 2025
Merged

kddnewton merged 1 commit into
mainfrom
mark-as-ractor-safe

Conversation

@kddnewton

Copy link
Copy Markdown
Collaborator

@tenderlove does this look okay to you? I'm less familiar with Ractors, but wanted to make sure this was okay. From the documentation on Ractor safety, I believe this is okay?

@kddnewton
kddnewton force-pushed the mark-as-ractor-safe branch from 6eeae95 to be583c7 Compare March 12, 2025 17:28

@tenderlove tenderlove left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change makes sense to me. I guess there's some tests failing though?

@kddnewton
kddnewton force-pushed the mark-as-ractor-safe branch from be583c7 to 10e5431 Compare March 12, 2025 19:07
@kddnewton

Copy link
Copy Markdown
Collaborator Author

Yeah, just because I forgot to check HAVE_RB_EXT_RACTOR_SAFE for Ruby 2.7.

@kddnewton
kddnewton merged commit a0eb6c2 into main Mar 12, 2025
@kddnewton
kddnewton deleted the mark-as-ractor-safe branch March 12, 2025 19:15
@XrXr

XrXr commented Mar 12, 2025

Copy link
Copy Markdown
Member

A bunch of weird test failures started happening in ruby/ruby when this landed:

  
    1) Failure:
  TestObjectSpace#test_each_object [/Users/runner/work/ruby/ruby/src/test/ruby/test_objectspace.rb:226]:
  <1> expected but was
  <0>.
  
    2) Failure:
  TestObjectSpace#test_each_object_enumerator [/Users/runner/work/ruby/ruby/src/test/ruby/test_objectspace.rb:237]:
  <1> expected but was
  <0>.
  
    3) Error:
  TestObjectSpace#test_id2ref_32:
  Test::Unit::ProxyError: "32616" is id of the unshareable object on multi-ractor
      /Users/runner/work/ruby/ruby/src/test/ruby/test_objectspace.rb:32:in 'ObjectSpace._id2ref'
      /Users/runner/work/ruby/ruby/src/test/ruby/test_objectspace.rb:32:in 'block in TestObjectSpace#deftest_id2ref'
    klass = Class.new
    new_obj = klass.new

    found = []
    count = ObjectSpace.each_object(klass) do |obj|
      found << obj
    end
#>> assert_equal(1, count)

Seems something is missing. https://github.com/ruby/ruby/actions/runs/13819663391/job/38661667031#step:14:1953

@eregon

eregon commented Mar 12, 2025 •

Copy link
Copy Markdown
Member

I suspect that's because this adds tests for Ractor in the same process, and Ractor simply isn't compatible enough (e.g. it changes the semantics of ObjectSpace.each_object: https://bugs.ruby-lang.org/issues/21149), and so no Ractor must be created in the main test process in CRuby test-all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants