ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "tenderlovemaking (Aaron Patterson)" <noreply@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:105582] [Ruby master Bug#18232] Ractor.make_shareable is broken in code loaded with RubyVM::InstructionSequence.load_from_binary
Date: Wed, 06 Oct 2021 21:03:36 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-94052.20211006210336.7941@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-18232.20210930114744.7941@ruby-lang.org

Issue #18232 has been updated by tenderlovemaking (Aaron Patterson).

File 0001-Dump-outer-variables-tables-when-dumping-an-iseq-to-.patch added

I've attached a patch that fixes this (for me) along with a test.  I had to change the information that we dump when dumping an ISeq, so maybe we need to change the binary format version number or something?  I'm not sure.  Anyway there is also a PR [here](https://github.com/ruby/ruby/pull/4942)

----------------------------------------
Bug #18232: Ractor.make_shareable is broken in code loaded with RubyVM::InstructionSequence.load_from_binary
https://bugs.ruby-lang.org/issues/18232#change-94052

* Author: byroot (Jean Boussier)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.2p107, ruby 3.1.0dev
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
This was first reported as a Bootsnap bug: https://github.com/Shopify/bootsnap/issues/376

But I reduced it to:

```ruby
source = <<~RUBY
  x = :foo
  pr = Proc.new { p x }
  Ractor.make_shareable(pr)
  pr.call
RUBY
RubyVM::InstructionSequence.compile(source).eval # :foo
RubyVM::InstructionSequence.load_from_binary(RubyVM::InstructionSequence.compile(source).to_binary).eval # false
```

The bug is present on both 3.0.2 and 3.1.0-dev. I have no idea what might cause this.

---Files--------------------------------
0001-Dump-outer-variables-tables-when-dumping-an-iseq-to-.patch (5.55 KB)


-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2021-10-06 21:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 11:47 [ruby-core:105504] [Ruby master Bug#18232] Ractor.make_shareable is broken in code loaded with RubyVM::InstructionSequence.load_from_binary byroot (Jean Boussier)
2021-10-06  9:22 ` [ruby-core:105567] " byroot (Jean Boussier)
2021-10-06 18:31 ` [ruby-core:105574] " Eregon (Benoit Daloze)
2021-10-06 18:38 ` [ruby-core:105575] " Eregon (Benoit Daloze)
2021-10-06 18:47 ` [ruby-core:105577] " tenderlovemaking (Aaron Patterson)
2021-10-06 21:03 ` tenderlovemaking (Aaron Patterson) [this message]
2021-10-16  4:56 ` [ruby-core:105652] " nagachika (Tomoyuki Chikanaga)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-94052.20211006210336.7941@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).