| Message |
 |
Date: 2009-12-06 17:35
Sender: Michael Guterl
Can we please get the fix in http://github.com/ghazel/daemons
included in an official daemons gem release?
Many people experience these issues and I wasted lots of time
trying different hacks until I found Greg Hazel's fork. |
Date: 2009-11-16 17:00
Sender: Jonah Williams
I have also encountered this bug and have to agree with James;
I unfortunately cannot use daemons in its current state.
There seems to be a simple fix described in this thread
and implemented in Greg's fork
(http://github.com/ghazel/daemons/tree/). What is blocking this
bug from being resolved? |
Date: 2009-06-17 07:39
Sender: James Le Cuirot
I think this needs addressing soon. It was effectively rendering
daemons useless for me and monit was throwing a fit over it.
I like the simplicity of Greg's fix and it works well for me.
You get that satisfying pause where you know it's patiently doing
the right thing and monit now correctly registers a restart as
a PID change instead of panicking. The code you actually need
is..
pid = @pid.pid
begin
loop do
Process.kill(SIGNAL, pid)
sleep 0.1
end
rescue Errno::ESRCH, Errno::ECHILD
end
You can't work on @pid.pid directly because when the process
successfully stops, the PID file gets deleted and the next time
@pid.pid gets called, it fails because the file is no longer
there. |
Date: 2009-02-27 04:17
Sender: Greg Hazel
Ok, more than one line. Process.wait doesn’t work because the
pid is not a child of the process that is stopping everything.
Instead you need:
def fancy_wait pid
begin
while (1) do
Process.kill(0, pid)
sleep 0.1
end
rescue Errno::ESRCH, Errno::ECHILD
end
end
|
Date: 2009-02-26 21:27
Sender: Greg Hazel
I believe the solution to this bug is much simpler than that.
The "stop" functions send "TERM" then delete
the pidfile, without waiting. An exiting daemon also removes
the pidfile, but this could be well after a second daemon is
started - resulting in a running daemon with no pidfile.
I believe the bug is easily fixed by adding one line,
"Process.wait" to the stop commands, as indicated in
the Process.kill docs: http://www.ruby-doc.org/core/classes/Proce
ss.html#M003183
|
Date: 2008-07-03 14:06
Sender: Thomas Uehlinger
Hi Chris,
I've just asked the author of the patch to allow me to include
it in the next release - so stay tuned!
Thanks for the report.
- Thomas |
Date: 2008-07-02 18:48
Sender: chris johnson
Sorry, I posted this too early by accident.
"script/daemon stop" sometiems leaves processes alive.
While researching this issue, I came across a patch that
seems to be a fix. Have a look here:
http://blog.rapleaf.com/dev/?p=19
Any chance of getting this incorporated into the next gem
release?
Thanks. |