From: "nagachika (Tomoyuki Chikanaga)" <nagachika00@...>
Date: 2013-10-04T14:22:58+09:00
Subject: [ruby-core:57659] [ruby-trunk - Bug #8616] Process.daemon messes up	threads


Issue #8616 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: UNKNOWN, 2.0.0: REQUIRED

I'll check r41910 to be backported later.

This ticket can be closed (for trunk)?
----------------------------------------
Bug #8616: Process.daemon messes up threads
https://bugs.ruby-lang.org/issues/8616#change-42277

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


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