ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: peter@peterzhu.ca
To: ruby-core@ruby-lang.org
Subject: [ruby-core:102071] [Ruby master Bug#17538] Assertion failure when rincgc is turned off
Date: Wed, 13 Jan 2021 19:06:35 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-17538.20210113190635.42491@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17538.20210113190635.42491@ruby-lang.org

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/

           reply	other threads:[~2021-01-13 19:06 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <redmine.issue-17538.20210113190635.42491@ruby-lang.org>]

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.issue-17538.20210113190635.42491@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).