Skip to content

Commit 7d9558f

Browse files
committed
Adjust test to avoid bug
1 parent 1d3fe2c commit 7d9558f

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

bootstraptest/test_ractor.rb

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,13 +2417,24 @@ def call_test(obj)
24172417
# When creating bmethods in Ractors, they should only be usable from their
24182418
# defining ractor, even if it is GC'd
24192419
assert_equal 'ok', <<~'RUBY'
2420-
CLASSES = 1000.times.map do
2421-
Ractor.new do
2422-
Class.new do
2423-
define_method(:foo) {}
2424-
end
2420+
CLASSES = 1000.times.map { Class.new }.freeze
2421+
2422+
# This would be better to run in parallel, but there's a bug with lambda
2423+
# creation and YJIT causing crashes in dev mode
2424+
ractors = CLASSES.map do |klass|
2425+
Ractor.new(klass) do |klass|
2426+
Ractor.receive
2427+
klass.define_method(:foo) {}
24252428
end
2426-
end.map(&:value).freeze
2429+
end
2430+
2431+
ractors.each do |ractor|
2432+
ractor << nil
2433+
ractor.join
2434+
end
2435+
2436+
ractors.clear
2437+
GC.start
24272438
24282439
any = 1000.times.map do
24292440
Ractor.new do

0 commit comments

Comments
 (0)