Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why parent process does not care about child #69

Open
isqad opened this issue May 29, 2018 · 0 comments
Open

Why parent process does not care about child #69

isqad opened this issue May 29, 2018 · 0 comments

Comments

@isqad
Copy link

isqad commented May 29, 2018

Hello! Andrew here!
I have a question about the line

pid = rd.read.to_i

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant