Issue #18283 has been reported by mame (Yusuke Endoh).

----------------------------------------
Bug #18283: Creating a subclass in Ractor dumps core
https://bugs.ruby-lang.org/issues/18283

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
```
$ ruby -e 'class C;end; (1..10).map { Ractor.new { 100000.times { Class.new(C) } } }.each {|r| r.take }'
<internal:ractor>:267: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
-e:1: [BUG] Segmentation fault at 0x00007fc7c802ecf2
ruby 3.1.0dev (2021-11-02T01:24:35Z master 38785aa3b9) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0006 p:---- s:0021 e:000020 CFUNC  :initialize
c:0005 p:---- s:0018 e:000017 CFUNC  :new
c:0004 p:0020 s:0013 e:000012 BLOCK  -e:1 [FINISH]
c:0003 p:---- s:0010 e:000009 CFUNC  :times
c:0002 p:0005 s:0006 e:000005 BLOCK  -e:1 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
-e:1:in `block (2 levels) in <main>'
-e:1:in `times'
-e:1:in `block (3 levels) in <main>'
-e:1:in `new'
-e:1:in `initialize'

-- Machine register context ------------------------------------------------
 RIP: 0x000056325882a857 RBP: 0x00007fc041c11cf0 RSP: 0x00007fc0412c9e20
 RAX: 0x00007fc030016cb8 RBX: 0x00007fc041c11cf0 RCX: 0x000056325a714320
 RDX: 0x00007fc7c802ecda RDI: 0x00007fc03c0191e0 RSI: 0x00000000001ca6d8
  R8: 0x00007fc03c019130  R9: 0x000056325a714138 R10: 0x0000000000000028
 R11: 0x0000000000000000 R12: 0x0000000000000000 R13: 0x00007fc041c10000
 R14: 0x0000000000000000 R15: 0x000056325a714100 EFL: 0x0000000000010206

-- C level backtrace information -------------------------------------------
/home/mame/work/ruby2/local/bin/ruby(rb_print_backtrace+0x11) [0x5632587d6c18] vm_dump.c:759
/home/mame/work/ruby2/local/bin/ruby(rb_vm_bugreport) vm_dump.c:1045
/home/mame/work/ruby2/local/bin/ruby(rb_bug_for_fatal_signal+0xec) [0x5632585c993c] error.c:820
/home/mame/work/ruby2/local/bin/ruby(sigsegv+0x4d) [0x56325872a63d] signal.c:964
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7fc045cdd1f0] ../sysdeps/pthread/funlockfile.c:28
/home/mame/work/ruby2/local/bin/ruby(rb_class_remove_from_super_subclasses+0x27) [0x56325882a857] class.c:90
/home/mame/work/ruby2/local/bin/ruby(obj_free+0x37a) [0x5632585edaaa] gc.c:3143
/home/mame/work/ruby2/local/bin/ruby(gc_plane_sweep+0x50) [0x5632585edfd0] gc.c:5345
...
```

An operation against the linked list of subclasses is not thread-safe. Related to #18282



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>