From: sin@... Date: 2021-01-12T10:21:02+00:00 Subject: [ruby-core:102030] [Ruby master Bug#17529] Ractor Segfaults with GC enabled Issue #17529 has been updated by prajjwal (Prajjwal Singh). @ko1 It crashes for any value of ARGV[0] between 1 and 25 (that I tested). The fact that its happening so consistently for me and not for you makes me wonder if the problem stems from my version of Linux or GCC? Some other compile time option perhaps? Here's my GCC version: ``` Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-werror gdc_include_dir=/usr/include/dlang/gdc Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.2.0 (GCC) ``` And Linux: ``` Linux Wraith 5.9.14-arch1-1 #1 SMP PREEMPT Sat, 12 Dec 2020 14:37:12 +0000 x86_64 GNU/Linux ``` Ruby Configure Args ``` '--prefix=/home/prajjwal/.rbenv/versions/3.0.0' '--enable-shared' 'LDFLAGS=-L/home/prajjwal/.rbenv/versions/3.0.0/lib ' 'CPPFLAGS=-I/home/prajjwal/.rbenv/versions/3.0.0/include ' ``` ---------------------------------------- Bug #17529: Ractor Segfaults with GC enabled https://bugs.ruby-lang.org/issues/17529#change-89882 * Author: prajjwal (Prajjwal Singh) * Status: Open * Priority: Normal * ruby -v: 3.0.0 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- I've been benchmarking `Ractor` on my machine with the following naive prime number generator: ```ruby # frozen_string_literal: true def prime?(n) 2.upto(n - 1).none? { |i| n % i == 0 } end NUM_WORKERS = ARGV[0].to_i producer = Ractor.new do i = 1000000 loop { Ractor.yield i; i += 1 } end workers = (1..NUM_WORKERS).map do Ractor.new producer do |producer| while n = producer.take Ractor.yield [n, prime?(n)] end end end loop do _r, ( number, prime ) = Ractor.select(*workers) p number if prime end ``` The code inevitably segfaults, and it appears to be the garbage collector. If I stick `GC.disable` in there, the code happily chugs along for several minutes on end without a problem. ---Files-------------------------------- ractor.crash (22.5 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: