From: "jhawthorn (John Hawthorn) via ruby-core" Date: 2026-10-13T21:13:34+00:00 Subject: [ruby-core:127096] [Ruby Bug#22434] "No live threads left. Deadlock?" when running system() or spawn in Ractors Issue #22434 has been reported by jhawthorn (John Hawthorn). ---------------------------------------- Bug #22434: "No live threads left. Deadlock?" when running system() or spawn in Ractors https://bugs.ruby-lang.org/issues/22434 * Author: jhawthorn (John Hawthorn) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: REQUIRED ---------------------------------------- Non-main Ractors don't support `fork()`, but do support `system()` and `spawn()`. They can end up deadlocked inside the prefork method when trying to flush stdio. ``` $stdout = File.open(File::NULL, "w") writer = Thread.new { loop { $stdout.write("x" * 100 + "\n"); $stdout.flush } } r = Ractor.new { 500.times { system("true") }; :done } raise unless :done == r.value writer.kill.join ``` ``` ��� ruby -v test.rb ruby 4.0.7 (2026-09-15 revision 229531a6cf) +PRISM [arm64-darwin25] test.rb:3: warning: Ractor API is experimental and may change in future versions of Ruby. # terminated with exception (report_on_exception is true): test.rb:3:in 'Kernel#system': No live threads left. Deadlock? (fatal) 1 threads, 1 sleeps current:0x00000007e696b800 main thread:0x00000007e696b800 * # rb_thread_t:0x00000007e696b800 native:0x000000016bcef000 int:0 test.rb:3:in 'Kernel#system' test.rb:3:in 'block (2 levels) in
' test.rb:3:in 'Integer#times' test.rb:3:in 'block in
' ... ``` https://github.com/ruby/ruby/pull/19321 -- 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/