daemons
daemons copied to clipboard
Why parent process does not care about child
Hello! Andrew here! I have a question about the line https://github.com/thuehlinger/daemons/blob/6f0ea6b15c6c1ca1bf23119156117fffa58d6514/lib/daemons/daemonize.rb#L49
Here we got pid from child throw pipe. But then we do not call Process.waitpid / Process.detach for it. Why?
Every time when child process terminated in docker container I get "zombie" process, because tmppid and pid are diffirent.
Here I set log:
diff --git a/lib/daemons/daemonize.rb b/lib/daemons/daemonize.rb
index bce7246..e9ec5ca 100644
--- a/lib/daemons/daemonize.rb
+++ b/lib/daemons/daemonize.rb
@@ -49,6 +49,9 @@ module Daemonize
pid = rd.read.to_i
rd.close
+ logger = Logger.new('/tmp/daemons.log')
+ logger.info [pid, tmppid].inspect
+
Process.waitpid(tmppid)
return pid
cat /tmp/daemons.log
# Logfile created on 2018-05-29 13:27:52 +0500 by logger.rb/56504
[38, 35]
Regards, Andrew!