Project

General

Profile

Actions

Bug #22460

closed

Ractor crash, shared arrays

Bug #22460: Ractor crash, shared arrays

Added by kddnewton (Kevin Newton) 1 day ago. Updated about 17 hours ago.

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

Description

I'm sorry I have no idea what is going on with this, but this crashes:

a = Array.new(200, 0)
b = a.pop(150)
a << 0
b.freeze
Ractor.shareable?(b)

Replacing pop with slice! fixes it, if that helps.

Updated by eightbitraptor (Matt V-H) about 17 hours ago Actions #1

  • Assignee set to eightbitraptor (Matt V-H)

Updated by eightbitraptor (Matt V-H) about 17 hours ago Actions #2

  • Status changed from Open to Closed

Applied in changeset git|0d83a93784090400ce38f0852ae11bc103765810.


Unshare arrays only when they become shareable

obj_traverse_i called rb_ary_cancel_sharing on every array it visited,
before the traversal knew whether the object graph was shareable.

So Ractor.shareable? modified frozen arrays even when it returned false.

This commit moves rb_ary_cancel_sharing into mark_shareable, which
runs only after the traversal succeeds.

[Bug #22460]

Actions

Also available in: PDF Atom