From: nagachika00@... Date: 2019-03-12T23:59:53+00:00 Subject: [ruby-core:91802] [Ruby trunk Bug#15013] thread_pthread.c: reinitialize ubf_list at fork Issue #15013 has been updated by nagachika (Tomoyuki Chikanaga). MEMO: backporting r64485 and r64635 cause some make test failures on my environment. I give up to fix these for just now. ``` #257 test_fork.rb:31:in `': begin r, w = IO.pipe if pid1 = fork w.close r.read(1) Process.kill("USR1", pid1) _, s = Process.wait2(pid1) s.success? ? :ok : :ng else r.close if pid2 = fork trap("USR1") { Time.now.to_s; Process.kill("USR2", pid2) } w.close Process.wait2(pid2) else w.close sleep 0.2 end exit true end rescue NotImplementedError :ok end #=> "ng" (expected "ok") [ruby-core:28924] stderr output is not empty bootstraptest.tmp.rb:13:in `kill': No such process (Errno::ESRCH) from bootstraptest.tmp.rb:13:in `block in
' from bootstraptest.tmp.rb:15:in `wait2' from bootstraptest.tmp.rb:15:in `
' test_fork.rb FAIL 1/5 #455 test_io.rb:87:in `block in ': at_exit { p :foo } megacontent = "abc" * 12345678 #File.open("megasrc", "w") {|f| f << megacontent } t0 = Thread.main Thread.new { sleep 0.001 until t0.stop?; Process.kill(:INT, $$) } r1, w1 = IO.pipe r2, w2 = IO.pipe t1 = Thread.new { w1 << megacontent; w1.close } t2 = Thread.new { r2.read; r2.close } IO.copy_stream(r1, w2) rescue nil w2.close r1.close t1.join t2.join #=> killed by SIGKILL (signal 9) (timeout) megacontent-copy_stream test_io.rb FAIL 1/9 FAIL 2/1201 tests failed ``` ---------------------------------------- Bug #15013: thread_pthread.c: reinitialize ubf_list at fork https://bugs.ruby-lang.org/issues/15013#change-77075 * Author: normalperson (Eric Wong) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED ---------------------------------------- thread_pthread.c: reinitialize ubf_list at fork It's possible for the ubf_list_head to be populated with dead threads at fork or the ubf_list_lock to be held, so reinitialize both at startup. And while we're at it, use a static initializer at startup to save a library call and kill some ifdef. ---Files-------------------------------- 0001-thread_pthread.c-reinitialize-ubf_list-at-fork.patch (2.46 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: