The problem is that the @pid.pid in Deamons::Application is not getting updated when Daemonize.call_as_deamon is run because it is being set in the child process. You can see the problem by running the call examples (they run but leave processes running since Daemons.group.stop_all(true) wont find them without pids). This got broken by a commit which tried to avoid the race condition that happens when a parent process and child process try to update the same variable, but that would only happen if call_as_deamon ran a thread instead of a fork. Fortunately the function already handles interprocess communication using IO pipes, so we just need to revert the commit's changes to daemons/lib/daemons/application.rb to fix this.
The problem is that the
@pid.pid
inDeamons::Application
is not getting updated whenDaemonize.call_as_deamon
is run because it is being set in the child process. You can see the problem by running the call examples (they run but leave processes running sinceDaemons.group.stop_all(true)
wont find them without pids). This got broken by a commit which tried to avoid the race condition that happens when a parent process and child process try to update the same variable, but that would only happen ifcall_as_deamon
ran a thread instead of a fork. Fortunately the function already handles interprocess communication using IO pipes, so we just need to revert the commit's changes to daemons/lib/daemons/application.rb to fix this.