From: "nagachika (Tomoyuki Chikanaga)" Date: 2022-09-25T04:43:56+00:00 Subject: [ruby-core:110058] [Ruby master Bug#18902] Thread#value crash if the thread was killed because of a fork Issue #18902 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED to 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE ruby_3_1 720de2008ca06edb22e5ad7d1432fee4f2575e00 merged revision(s) 65ae2bb2e045aa8b668d3c30515f5a6cb3eb68ad. ---------------------------------------- Bug #18902: Thread#value crash if the thread was killed because of a fork https://bugs.ruby-lang.org/issues/18902#change-99309 * Author: byroot (Jean Boussier) * Status: Closed * Priority: Normal * ruby -v: ruby 3.2.0dev, ruby 3.1.2p20, ruby 3.0.3p157, ruby 2.7.5p203 * Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE ---------------------------------------- Reproduction script ```ruby thr = Thread.new { sleep 10} fork do p thr.status # =>false p thr.join # => # p thr.value # Assertion Failed: ./vm_core.h:1303:VM_ENV_FLAGS:FIXNUM_P(flags) (or crash if RUBY_DEBUG isn't set) end ``` What happens is that `rb_thread_t->value` is initialized to `Qundef`, so when the thread is killed by a fork, `Thread#value` tries to return `Qundef` which laters crash the VM. I have a patch incomming. -- https://bugs.ruby-lang.org/ Unsubscribe: