Project

General

Profile

Actions

Bug #19374

open

Issue with Ractor.make_shareable with curried procs

Added by luke-gru (Luke Gruber) about 1 year ago. Updated about 1 year ago.

Status:
Assigned
Target version:
-
[ruby-core:112005]

Description

This works, but shouldn't:

class Worker
  def start(&blk)
    blk = blk.curry # bug in ruby allows sharing of non-shareable proc
    Ractor.make_shareable(blk)
    @ractor = Ractor.new(blk) do |b|
      main = b.call
      p "from ractor: #{main}"
    end
  end

  def work
    @ractor.take
  end
end

worker = Worker.new
a = self # unshareable main object
p "from main: #{a}"
worker.start { a }

worker.work

The curried proc has a reference to the original proc and it's not checked for shareability.

Updated by luke-gru (Luke Gruber) about 1 year ago

This issue is fixed by https://github.com/ruby/ruby/pull/7182. I will add a test to that PR for this.

Updated by hsbt (Hiroshi SHIBATA) about 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to ko1 (Koichi Sasada)
Actions

Also available in: Atom PDF

Like0
Like0Like0