From: "tompng (tomoya ishida) via ruby-core" Date: 2026-04-15T13:21:20+00:00 Subject: [ruby-core:125278] [Ruby Bug#21999] Sometimes getting segfault and sometimes getting a "Floating point exception" when running some ractor code involving BigDecimal Issue #21999 has been updated by tompng (tomoya ishida). Shorter reproduction code: ~~~ruby require 'bigdecimal' 4.times.map do Ractor.new do loop { raise unless BigDecimal(3.14) } end end sleep 1 GC.start ~~~ I guess this is a bug of BigDecimal's float parsing logic. If the float value is changed to `314.0`, it won't crash. I've filed an issue to ruby/bigdecimal https://github.com/ruby/bigdecimal/issues/527 ---------------------------------------- Bug #21999: Sometimes getting segfault and sometimes getting a "Floating point exception" when running some ractor code involving BigDecimal https://bugs.ruby-lang.org/issues/21999#change-117032 * Author: miles-georgi (Miles Georgi) * Status: Open * ruby -v: ruby 4.0.2 (2026-03-17 revision d3da9fec82) +PRISM [x86_64-linux] * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- Hey hey! I don't know if this might be a duplicate of https://bugs.ruby-lang.org/issues/21992 as the code involves two subclasses of BasicObject that have #initialize methods defined. Apologies if a dup of that! I'm not sure how best to run this against the current tip of ruby but am happy to try that if somebody can point me to how to do it. When running the script here: https://github.com/ractor-shack/ractorize/blob/main/example_scripts/product-benchmark-segfault I sometimes see a segfault and sometimes I get a "Floating point exception. This does use "bigdecimal" so not sure if the bug might be there. To reproduce, you could clone that repo, go into the example-scripts directory, bundle install, and ./product-benchmark-segfault You might have to run it a few times to see the various bad outcomes. Using 4.0.2 on a debian trixie machine with ruby installed via rbenv. I'll attach some output text. segfault2.txt happens sometimes and has tons of info. This also happens if using path: ".." to point it at the local files instead of the installed gem. I do know C and could attempt to help with this sort of thing. Though, somebody would likely have to be interested in pairing with me to help me ramp up on how to debug a project like MRI. Cheers! ---Files-------------------------------- corrupted_top_size_plus_floating_point_exception.txt (1.28 KB) floating_point_exception.txt (851 Bytes) lucky_successful_run.txt (851 Bytes) segfault1.txt (3.1 KB) segfault2.txt (48.1 KB) product-benchmark-segfault (1.23 KB) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/