Project

General

Profile

Actions

Bug #17636

closed

Race condition in check_rvalue_consistency_force when using ractors

Added by peterzhu2118 (Peter Zhu) about 3 years ago. Updated about 3 years ago.

Status:
Closed
Target version:
-
[ruby-core:102543]

Description

GitHub PR

When RGENGC_CHECK_MODE is enabled and we use multiple ractors, there is a race condition in check_rvalue_consistency_force that causes an assertion to fail. It happens when a page is created during the call to is_pointer_to_heap, which causes the binary search to fail.

Reproduction

NUM_RACTORS = 10

rs = NUM_RACTORS.times.map do |i|
  Ractor.new(i) do |i|
    arr = []
    
    10_000.times do |j|
      arr << "foo.#{i}.#{j}"
    end

    arr
  end
end

arrs = rs.map { |r| r.take }

The crash log is attached below in crash.log.


Files

crash.log (20.1 KB) crash.log peterzhu2118 (Peter Zhu), 02/16/2021 03:25 PM
Actions #1

Updated by peterzhu2118 (Peter Zhu) about 3 years ago

  • Description updated (diff)
Actions #2

Updated by ko1 (Koichi Sasada) about 3 years ago

  • Status changed from Open to Assigned
  • Assignee set to ko1 (Koichi Sasada)

Thank you. I got same issue.

Actions #3

Updated by ko1 (Koichi Sasada) about 3 years ago

  • Status changed from Assigned to Closed

Applied in changeset git|07ab172ebef28bb82c2650694548d123802d6c22.


sync check_rvalue_consistency_force()

check_rvalue_consistency_force() uses is_pointer_to_heap() and
it should be synchronized with other ractors.
[Bug #17636]

Actions #4

Updated by ko1 (Koichi Sasada) about 3 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: REQUIRED

Updated by naruse (Yui NARUSE) about 3 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: REQUIRED to 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: DONE

ruby_3_0 d3863cb2e80f27d26b521b2c957b21feacb900de merged revision(s) 07ab172ebef28bb82c2650694548d123802d6c22.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0