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=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham 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 F3E1D1F4B4 for ; Wed, 13 Jan 2021 19:06:52 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 545BE120B21; Thu, 14 Jan 2021 04:05:54 +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 6C6B9120B1E for ; Thu, 14 Jan 2021 04:05:51 +0900 (JST) Received: by filterdrecv-p3iad2-577c7fd65d-rzjvm with SMTP id filterdrecv-p3iad2-577c7fd65d-rzjvm-18-5FFF44BB-CE 2021-01-13 19:06:35.84680459 +0000 UTC m=+86881.139135560 Received: from herokuapp.com (unknown) by ismtpd0033p1iad2.sendgrid.net (SG) with ESMTP id DuVEtOS1QdCkXvWdEWwCCA for ; Wed, 13 Jan 2021 19:06:35.806 +0000 (UTC) Date: Wed, 13 Jan 2021 19:06:35 +0000 (UTC) From: peter@peterzhu.ca Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 77974 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17538 X-Redmine-Issue-Author: peterzhu2118 X-Redmine-Sender: peterzhu2118 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?RcuVSS+tS7sWhifKYzqjBA6GuxeyciWOTsA27PgjRkZudYDERCXSdzHH5tj3bu?= =?us-ascii?Q?AmEf2LEZthOi8jQNKeFDSz8fgWPCk9YTYOcg1DT?= =?us-ascii?Q?amounP4l3wY2DsPCyCApx6B8RNOfXFT1pVT7Q3N?= =?us-ascii?Q?jBH7Gw7XLU+0Rv=2FuqV8it48EzWDfAsAZJlyWeUb?= =?us-ascii?Q?QA=2F8ZDV=2Fdmhrg=2FoqnQfXkZxG+xYXPPddgEDOJVZ?= =?us-ascii?Q?WyZl5AsVPl8o6kvN8=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 102071 Subject: [ruby-core:102071] [Ruby master Bug#17538] Assertion failure when rincgc is turned off 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 #17538 has been reported by peterzhu2118 (Peter Zhu). ---------------------------------------- Bug #17538: Assertion failure when rincgc is turned off https://bugs.ruby-lang.org/issues/17538 * Author: peterzhu2118 (Peter Zhu) * Status: Open * Priority: Normal * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- [Pull request on GitHub](https://github.com/ruby/ruby/pull/4064). When compiling with `-DUSE_RINCGC=0` (turn off rincgc) and `-DRGENGC_CHECK_MODE=1` (turn on assertions), there is an assertion error when running multiple ractors. Reproduction script (on macOS 11.1): ```ruby rs = (1..30).map do |i| Ractor.new(i) do |i| "r#{i}" end end ``` Error: ``` Assertion Failed: ../gc.c:5193:gc_sweep_step:gc_mode(objspace) == gc_mode_sweeping ? heap->free_pages != NULL : 1 ``` This happens because another ractor may be using this page during sweeping, so it appears like the page has free slots but the freelist of the page is empty. For example, let's say we have pages P1, P2 and ractors R1, R2. Say R1 is using P1 and R2 is using P2. When P2 runs out of space, GC is started. But if nothing is swept in P1 and P1 still has space (in the ractor cache in R1), then `free_slots > 0` is true for P1 but `heap->free_pages == NULL` because the freelist of P2 is null. -- https://bugs.ruby-lang.org/