CARVIEW |
Select Language
HTTP/2 200
x-amz-id-2: oVZtJjp6EJxku3UEcFkC6oUD4CaxAOrpUtq0Eo8Kjrm2P8htDpkYl0TbMLKqOkm8Iu1YC4BS3oQ=
x-amz-request-id: QQVDG2QCETNAQ0AZ
last-modified: Tue, 08 Jul 2025 19:02:38 GMT
etag: "50118457db1f69a0a620da9e08f4d5bf"
x-amz-server-side-encryption: AES256
server: AmazonS3
content-encoding: gzip
via: 1.1 varnish, 1.1 varnish
content-type: text/plain; charset=utf-8
accept-ranges: bytes
age: 0
date: Wed, 23 Jul 2025 20:27:16 GMT
x-served-by: cache-tyo11957-TYO, cache-bom-vanm7210069-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753302436.193569,VS0,VE362
vary: Accept-Encoding
content-length: 838
From: "luke-gru (Luke Gruber) via ruby-core"
Date: 2025-07-08T18:50:53+00:00
Subject: [ruby-core:122683] [Ruby Bug#21504] [Ractor] Process.waitpid blocks ractor, new NT doesn't pick up other ractors
Issue #21504 has been reported by luke-gru (Luke Gruber).
----------------------------------------
Bug #21504: [Ractor] Process.waitpid blocks ractor, new NT doesn't pick up other ractors
https://bugs.ruby-lang.org/issues/21504
* Author: luke-gru (Luke Gruber)
* Status: Open
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
The following code hangs when run with `RUBY_MAX_CPU=2 make run`:
Note: `RUBY_MAX_CPU` is set to 2 so that only 1 non-main ractor can run at once.
test.rb:
```ruby
rs = []
2.times do |i|
rs << Ractor.new(i) do |i|
if i == 0
io = IO.popen("ruby -e 'sleep'")
Process.wait(io.pid) # block forever
else
sleep 1 # make sure first ractor blocks forever first
$stderr.puts "Running r #{i}"
100_000.times do
[nil] * 1_000
end
$stderr.puts "done r #{i}"
end
end
end
while rs.size == 2
r, obj = Ractor.select(*rs)
rs.delete(r)
end
```
The timer thread should create a new NT to compensate for the dedicated task, and the new NT should be able to pick up the other runnable ractor.
In contrast, the following works fine:
```ruby
rs = []
2.times do |i|
rs << Ractor.new(i) do |i|
if i == 0
r, w = IO.pipe
r.read(1) # block forever
else
sleep 1 # make sure first ractor blocks forever first
$stderr.puts "Running r #{i}"
100_000.times do
[nil] * 1_000
end
$stderr.puts "done r #{i}"
end
end
end
while rs.size == 2
r, obj = Ractor.select(*rs)
rs.delete(r)
end
```
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/