ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: keiju@ishitsuka•com (Keiju ISHITSUKA)
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50186] SIGCHLD and Thread dead-lock problem
Date: Wed, 26 Jul 2017 00:51:05 +0900	[thread overview]
Message-ID: <E1da26z-00069c-QB@keiju.ishitsuka.com> (raw)

けいじゅ@いしつかです.

下記のプログラムを実行するとThreadがデッドロックしたと例外が発生します.
# コメント部分をはずせば, デッドロックはしません

シグナルのtrapが絡むときのデッドロックの検知に問題があるのではないかと
思いますがいかがでしょう? 

% ruby -v
ruby 2.5.0dev (2017-07-25 trunk 59417) [i686-linux]

-- 
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 <<---

             reply	other threads:[~2017-07-25 15:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 15:51 Keiju ISHITSUKA [this message]
2017-12-18  1:56 ` [ruby-dev:50359] Re: SIGCHLD and Thread dead-lock problem Tomoyuki Chikanaga
2017-12-18 13:09   ` [ruby-dev:50364] " keiju ISHITSUKA

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1da26z-00069c-QB@keiju.ishitsuka.com \
    --to=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).