Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ruby/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,11 @@ Load River and worker definitions in the main Ractor before spawning others. Eac

Database drivers, Active Record, Sequel, and optional dependencies such as Fugit still need their own Ractor compatibility. Job timeouts also depend on Ruby and the `timeout` gem: the test suite exercises them on Ruby 4 with `timeout` 0.6.1; tests on older Rubies disable job timeouts. `WorkerRunner` handles process-wide signals and must run on the main thread of the main Ractor.

Ruby 3.3 and 3.4 can deadlock while scheduling threads inside Ractors, even
without River ([Ruby bug #20905](https://bugs.ruby-lang.org/issues/20905), fixed
in Ruby 4). The test suite skips the producer/maintenance lifecycle test on
those versions; insertion and synchronous worker checks still run.

Ruby 4.0.2 with `timeout` 0.6.1 can intermittently deadlock during VM shutdown
while terminating Ractors and their timeout helper threads, even after work
finishes successfully. This reproduces without River. Tests bypass that shutdown
Expand Down
7 changes: 7 additions & 0 deletions ruby/spec/ractor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ def worker.work(job)
end

it "starts producer/maintenance threads and stops within a non-main Ractor" do
# Ruby's M:N scheduler can lose a runnable Ractor when a thread exits,
# especially with few CPUs. This reproduces without River and is fixed in
# Ruby 4: https://bugs.ruby-lang.org/issues/20905.
if RUBY_VERSION.start_with?("3.3.", "3.4.")
skip "Ruby 3.3/3.4's threaded Ractor scheduler can deadlock (ruby-lang #20905)"
end

in_ractor <<~'RUBY'
config = River::Config.new(
workers: River::Workers.new.add(RactorTestWorker), queues: {default: 1},
Expand Down
Loading