On Sat, Nov 19, 2005 at 12:46:06AM +0900, Tanaka Akira wrote: > In article <437DE7CF.4000703 / shic.co.uk>, > "Steve [RubyTalk]" <steve_rubytalk / shic.co.uk> writes: > > > Should I have expected this? What would be the best way to address the > > problem? I don't see why having used fork should have affected > > threading. Can anyone explain? > > 1. fork doesn't copy other threads in the child process. > 2. fork+setsid daemonization kills the parent process. > > So the daemon process has only the thread which calls fork. > > Process.daemon in Ruby 1.9 may help you. It daemonize the > process without killing other threads. > -- > Tanaka Akira Also, if your process needs to be a daemon, that should be the first thing you do. This will avoid problems with threads since you won't have started anything that may be using them yet. Other things you might think about is changing the process directory to /. If you don't do this, you'll find that you can't umount the file system the daemon has as it's current directory if you need to. By default, it's current directory will be the current directory of the process that launched it. Maybe your home directory if you launched it by hand. I also always set the umask to something known since you don't really know the environment that the program will be run from. These things can be especially important for a daemon since they are usually meant to run for the life of the system. Good luck! Rick -- Rick Nooner rick / nooner.net http://www.nooner.net