Daemonised program dying on OSX
Dominic Mitchell
dom at happygiraffe.net
Tue Jan 23 10:54:08 GMT 2007
On Tue, Jan 23, 2007 at 09:18:02AM +0000, Peter Hickman wrote:
> I have a little perl program that runs in Daemon mode via Proc::Daemon
> that occasionally just dies on me. For the life of me I can't find any
> way of getting any information about why it is dying. Does anyone have
> any idea as to how I might debug this?
>
> Getting it to restart is no problem, I can just have a cron run every 5
> minutes try and restart the process and as it's using Proc::PidFile so
> there wont be more than one. But the fact that it is dying is really
> bugging me and I would like to fix the problem rather than cover it up.
>
> Oh yes, it's on OSX.
Probably the easiest way is to use ktrace. Depending on how busy the
program is, it may leave a large ktrace.out file however.
If you just do "ktrace -p $daemon_pid", it should leave a ktrrace.out
file in the current directory. Later, when the daemon has crashed, run
"kdump | tail -100" in the same directory. The last 100 lines or so of
output should give some indication as to why it's dying.
-Dom
More information about the london.pm
mailing list