Actions
Bug #21551
closedRactor isolation error points to the wrong place
Bug #21551:
Ractor isolation error points to the wrong place
Description
The following code has a bug in it. The block passed to Ractor.new references the outer channel variable, so it can't be isolated. The problem is that I forgot to add |channel| to the block:
channel = Ractor::Port.new
coordinator = Ractor.new(channel) do
inbound_work = Ractor::Port.new
channel << inbound_work
end
However, the exception this raises is strange:
> ruby thing.rb
thing.rb:3: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
thing.rb:3:in 'Ractor.new': can not isolate a Proc because it accesses outer variables (channel). (ArgumentError)
coordinator = Ractor.new(channel) do
^^^^^^^
from thing.rb:3:in '<main>'
I would expect the channel local inside the block to be underlined instead of the parameter passed to Ractor.new.
Updated by Anonymous 11 days ago
- Status changed from Open to Closed
Applied in changeset git|be8f647bdab59d16554900c16c101e453863918d.
[Bug #21551] changing the exception to be isolationerror rather than argument error
Actions