From: "luke-gru (Luke Gruber) via ruby-core" Date: 2023-12-29T18:51:23+00:00 Subject: [ruby-core:115976] [Ruby master Bug#20078] StringIO cannot be moved between Ractors Issue #20078 has been updated by luke-gru (Luke Gruber). I created a PR that updates the Ractor docs: https://github.com/ruby/ruby/pull/9395. It doesn't go into much detail about the situation but clarifies it a bit. Adding a `movable?` method would have have to be a separate ticket @forthoney. I think it's an okay idea, but I'm a bit concerned because then should we add a `copyable?` method too? We could just have a `sendable?` method that takes the `move` keyword, which could deal with both copying and moving cases. I think unit or integration tests would catch most cases of sending the wrong objects across Ractors, but I see a use for it. ---------------------------------------- Bug #20078: StringIO cannot be moved between Ractors https://bugs.ruby-lang.org/issues/20078#change-105940 * Author: forthoney (Seong-Heon Jung) * Status: Open * Priority: Normal * ruby -v: 3.2 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- The following code will raise an unusual Ractor error. ``` ruby require 'stringio' r = Ractor.new { loop { Ractor.receive } } Ractor.shareable?(StringIO.new) #=> false r.send(StringIO.new) # passing it via copy works r.send(StringIO.new, move: true) # :587:in `send': can not move StringIO object. (Ractor::Error) ``` I'm not 100% sure but I believe that this probably not the intended behavior considering * The error raised is a generic `Ractor::Error` rather than something specific like Ractor::MovedError or Ractor::IsolationError * It can be copied * [No documentation](https://docs.ruby-lang.org/en/master/ractor_md.html) exists for this error * I have yet to seen this happen on any other class instance * Typo (can not -> cannot) -- 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/postorius/lists/ruby-core.ml.ruby-lang.org/