Project

General

Profile

Actions

Bug #17985

closed

Ractor + GC: [BUG] not single ractor mode

Added by xtkoba (Tee KOBAYASHI) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0dev (2021-06-10T23:31:51Z master 9210f8df7f) [x86_64-linux]
[ruby-core:104260]

Description

The attached script (named bug17882-gcmod.rb) is a modification of bootstraptest/test_ractor.rb:224 that reads:

def test n
  # (...snip...)
end

GC.disable # newly added

p 30.times.map{|i|
  test i
}

GC.start # newly added

This script triggers a "not single ractor mode" bug:

<internal:ractor>:267: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
["ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok"]
<internal:gc>:35: [BUG] not single ractor mode
ruby 3.1.0dev (2021-06-10T23:31:51Z master 9210f8df7f) [x86_64-linux]
  built with clang version 12.0.1

-- Control frame information -----------------------------------------------
c:0003 p:0011 s:0014 e:000013 METHOD <internal:gc>:35
c:0002 p:0037 s:0006 e:000005 EVAL   /var/tmp/ruby/bug17882-gcmod.rb:31 [FINISH]
c:0001 p:0000 s:0003 E:000a70 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
/var/tmp/ruby/bug17882-gcmod.rb:31:in `<main>'
<internal:gc>:35:in `start'

-- C level backtrace information -------------------------------------------
(...snip...)

A bactrace with GDB:

Thread 1 "miniruby" hit Breakpoint 1, rb_bug (fmt=0x5555555a102d "not single ractor mode") at ../error.c:784
784         va_start(args, fmt);
(gdb) bt
#0  rb_bug (fmt=0x5555555a102d "not single ractor mode") at ../error.c:784
#1  0x000055555596e457 in transient_heap_evacuate (dmy=0x0) at ../transient_heap.c:779
#2  0x00005555559cac3e in rb_postponed_job_flush (vm=0x5555559f5be0) at ../vm_trace.c:1698
#3  0x000055555593f994 in rb_threadptr_execute_interrupts (th=0x5555559f80b0, blocking_timing=0) at ../thread.c:2431
#4  0x000055555599f03d in rb_vm_check_ints (ec=0x5555559f89c0) at ../vm_core.h:1941
#5  0x000055555597fd18 in vm_pop_frame (ec=0x5555559f89c0, cfp=0x7ffff7757f68, ep=0x7ffff7658078) at ../vm_insnhelper.c:412
#6  0x0000555555985f77 in vm_exec_core (ec=0x5555559f89c0, initial=0) at ../insns.def:906
#7  0x000055555599a0d5 in rb_vm_exec (ec=0x5555559f89c0, mjit_enable_p=true) at ../vm.c:2160
#8  0x000055555599b0d5 in rb_iseq_eval_main (iseq=0x7ffff7fc3d08) at ../vm.c:2417
#9  0x000055555576121e in rb_ec_exec_node (ec=0x5555559f89c0, n=0x7ffff7fc3d08) at ../eval.c:320
#10 0x00005555557610ae in ruby_run_node (n=0x7ffff7fc3d08) at ../eval.c:379
#11 0x00005555556acb54 in main (argc=2, argv=0x7fffffffd938) at ../main.c:47

Files

bug17882-gcmod.rb (426 Bytes) bug17882-gcmod.rb Repro: a mod of `bootstraptest/test_ractor.rb:224` xtkoba (Tee KOBAYASHI), 06/14/2021 06:08 PM
Actions #2

Updated by eileencodes (Eileen Uchitelle) over 3 years ago

  • Status changed from Open to Closed

Applied in changeset git|8209b735807d449c0a870562ee240585127ee100.


Evacuate transient heap when enabling ractors

If the GC has been disabled we need to re-enable it so we can evacuate
the transient heap.

Fixes https://bugs.ruby-lang.org/issues/17985

[Bug #17985] [ruby-core:104260]

Co-authored-by: Aaron Patterson

Actions

Also available in: Atom PDF

Like0
Like0Like0