From: "benweint (Ben Weintraub)" Date: 2013-09-25T12:56:00+09:00 Subject: [ruby-core:57365] [ruby-trunk - Bug #8616] Process.daemon messes up threads Issue #8616 has been updated by benweint (Ben Weintraub). Actually, it looks like this is fixed in Ruby 2.1.0-preview1 (Thread#alive? returns false for background threads spawned before a call to Process.daemon), but still broken in 2.0.0-p247. Any chance of a backport? ---------------------------------------- Bug #8616: Process.daemon messes up threads https://bugs.ruby-lang.org/issues/8616#change-41968 Author: tenderlovemaking (Aaron Patterson) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.1.0dev (2013-07-10 trunk 41870) [x86_64-darwin12.4.0] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN =begin Hi, When I daemonize a process, it somehow messes up threads from the parent process. Here is a script to reproduce the problem: r1, w1 = IO.pipe r2, w2 = IO.pipe t = Thread.new { puts "start" w1.write "x" IO.select([r2]) puts "alive" } IO.select([r1]) Process.daemon true, true # comment this line out and everything works puts Process.pid w2.write "x" t.join puts "done" If you run this program, there will be a ruby process in the background that never dies. If you comment out the "Process.daemon" line, the script finishes. =end -- http://bugs.ruby-lang.org/