From: samuel@... Date: 2020-11-07T08:03:06+00:00 Subject: [ruby-dev:50970] [Ruby master Bug#13768] SIGCHLD and Thread dead-lock problem Issue #13768 has been updated by ioquatix (Samuel Williams). @ko1 we discussed this briefly. I disagree with introducing `Thread.ignore_deadlock`. It should be responsibility of signal handler. ---------------------------------------- Bug #13768: SIGCHLD and Thread dead-lock problem https://bugs.ruby-lang.org/issues/13768#change-88378 * Author: keiju (Keiju Ishitsuka) * Status: Closed * Priority: Normal * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- けいじゅ@いしつかです. 下記のプログラムを実行するとThreadがデッドロックしたと例外が発生します. # コメント部分をはずせば, デッドロックはしません シグナルのtrapが絡むときのデッドロックの検知に問題があるのではないかと 思いますがいかがでしょう? ``` % ruby -v ruby 2.5.0dev (2017-07-25 trunk 59417) [i686-linux] ``` ```ruby q = Queue.new p = Queue.new trap(:SIGCHLD) do puts "SIGCHLD" q.push 1 end Thread.start do Process.spawn("/bin/sleep 1") end #Thread.start do # loop do # sleep 100 # end #end th = Thread.start{ p.push q.pop } p.pop ``` __ ---------------------------------------------------->> 石塚 圭樹 <<--- ---------------------------------->> e-mail: keiju@ishitsuka.com <<--- -- https://bugs.ruby-lang.org/