From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id C66EE1F4B4 for ; Fri, 25 Sep 2020 14:31:58 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 82F62120B39; Fri, 25 Sep 2020 23:31:19 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id CAA3F120B34 for ; Fri, 25 Sep 2020 23:31:16 +0900 (JST) Received: by filterdrecv-p3mdw1-5dd6bc5999-v8lqk with SMTP id filterdrecv-p3mdw1-5dd6bc5999-v8lqk-18-5F6DFF50-13 2020-09-25 14:31:44.063391174 +0000 UTC m=+318793.768115366 Received: from herokuapp.com (unknown) by ismtpd0039p1mdw1.sendgrid.net (SG) with ESMTP id tap3M9a4Qq698CrXQeTfhA for ; Fri, 25 Sep 2020 14:31:44.021 +0000 (UTC) Date: Fri, 25 Sep 2020 14:31:44 +0000 (UTC) From: eregontp@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75989 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 17188 X-Redmine-Issue-Author: Eregon X-Redmine-Sender: Eregon X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?KippOI8ZHtTweq7XfQzW93937kJ4QNWwSBuHnaMEcr0tCcXJb5susKypVbY4wL?= =?us-ascii?Q?nBFk5N8EcK+I9Pavpq2bdXq55rOueumGmRcpsNS?= =?us-ascii?Q?pGMKwY+j4sjvmwstAhGmb9MXnlNDYIhgUKwhymI?= =?us-ascii?Q?Mc3x1Ym91gCpKX4glfPeOZ5VXYlBFx1mV6OYPNk?= =?us-ascii?Q?zcBRE4ki4THxfT6VtcvZS0l7nn5=2FBz+AJxdtuot?= =?us-ascii?Q?tKTpd0OzIy7Nc2KeI=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 100148 Subject: [ruby-core:100148] [Ruby master Feature#17188] Freeze Encoding objects for Ractor X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17188 has been reported by Eregon (Benoit Daloze). ---------------------------------------- Feature #17188: Freeze Encoding objects for Ractor https://bugs.ruby-lang.org/issues/17188 * Author: Eregon (Benoit Daloze) * Status: Open * Priority: Normal * Target version: 3.0 ---------------------------------------- Currently Encoding objects are not frozen: ``` $ ruby -ve 'p Encoding::US_ASCII.frozen?' ruby 3.0.0dev (2020-09-25T08:28:42Z master 81dc37b1b4) [x86_64-linux] false ``` That means they cannot be accessed in a Ractor: ```ruby irb(main):001:0> Encoding::US_ASCII => # irb(main):002:0> Ractor.new { Encoding::US_ASCII } :38: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues. => # # terminated with exception (report_on_exception is true): (irb):2:in `block in irb_binding': can not access non-sharable objects in constant Encoding::US_ASCII by non-main Ractor. (NameError) ``` And `Ractor.new { p "".encoding }` is likely violating the Ractor guarantees. I think we can make all Encoding instances frozen. Making them frozen is also useful for code sharing, which TruffleRuby aims to support via the GraalVM Engine/Context API. cc @ko1 -- https://bugs.ruby-lang.org/