[ruby-core:122468] [Ruby Bug#17516] forking in a ractor causes Ruby to crash
From:
"jhawthorn (John Hawthorn) via ruby-core" <ruby-core@...>
Date:
2025-06-05 18:23:48 UTC
List:
ruby-core #122468
Issue #17516 has been updated by jhawthorn (John Hawthorn).
Right now forking with a block or forking and execing works without crashing
```
./miniruby -e 'Ractor.new { fork(){} }.take'
```
However as described in the issue forking with no block still crashes.
```
./miniruby -e 'Ractor.new { fork() }.take'
-e:1: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
-e:1: warning: Ractor#take was deprecated and use Ractor#value instead. This method will be removed after the end of Aug 2025
[BUG] rb_thread_terminate_all: called by child thread (0x0000000000000000, 0x00005949b17c44e0)
ruby 3.5.0dev (2025-06-05T18:01:41Z master 3e626a6aed) +PRISM [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0001 p:---- s:0003 e:000002 DUMMY [FINISH]
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- C level backtrace information -------------------------------------------
```
----------------------------------------
Bug #17516: forking in a ractor causes Ruby to crash
https://bugs.ruby-lang.org/issues/17516#change-113656
* Author: pkmuldoon (Phil Muldoon)
* Status: Assigned
* Assignee: ractor
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I just want to point out, there's absolutely no reason to do this, but
r = Ractor.new do
Process.fork()
end
Will cause:
<internal:ractor>:267: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
[BUG] rb_thread_terminate_all: called by child thread (0x0000700004ddca40, 0x00007f981b567ee0)
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
c:0001 p:---- s:0003 e:000002 (none) [FINISH]
-- C level backtrace information -------------------------------------------
=> #<Ractor:#3 (pry):5 terminated>
[4] pry(main)> /Users/phillipmuldoon/.rubies/ruby-3.0.0/bin/ruby(rb_vm_bugreport+0x6cf) [0x103084d1f]
/Users/phillipmuldoon/.rubies/ruby-3.0.0/bin/ruby(rb_bug_without_die+0x206) [0x102e9e2b6]
/Users/phillipmuldoon/.rubies/ruby-3.0.0/bin/ruby(rb_bug+0x71) [0x103091e6b]
/Users/phillipmuldoon/.rubies/ruby-3.0.0/bin/ruby(rb_thread_terminate_all+0x329) [0x10301e5b9]
/Users/phillipmuldoon/.rubies/ruby-3.0.0/bin/ruby(rb_ractor_terminate_all+0xa3) [0x102f8acc3]
/Users/phillipmuldoon/.rubies/ruby-3.0.0/bin/ruby(rb_ec_cleanup+0x229) [0x102ea9299]
/Users/phillipmuldoon/.rubies/ruby-3.0.0/bin/ruby(ruby_stop+0x9) [0x102ea9509]
/Users/phillipmuldoon/.rubies/ruby-3.0.0/bin/ruby(thread_start_func_2+0x8ce) [0x103027fce]
/Users/phillipmuldoon/.rubies/ruby-3.0.0/bin/ruby(thread_start_func_1+0x10d) [0x10302753d]
/usr/lib/system/libsystem_pthread.dylib(_pthread_start+0xe0) [0x7fff20382950]
---Files--------------------------------
ruby_2021-01-06-104315_phillip-muldoon-FA588.crash (31.8 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/