Project

General

Profile

Actions

Bug #8616

closed

Process.daemon messes up threads

Added by tenderlovemaking (Aaron Patterson) over 11 years ago. Updated almost 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-07-10 trunk 41870) [x86_64-darwin12.4.0]
[ruby-core:55886]

Description

=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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0