I have written a perl program that runs as a daemon on my Linux system but unfortunately the program dies sporadically (once every three weeks or so of continuous execution) and I'm trying to find out why. I use the -w switch and also strict, but I have not been able to consistently cause the program to die so it is difficult to troubleshoot. The program seems to die under both perl version 5.6.0 and 5.6.1. I have not tried running the program under the perl debugger since 99% of the time the program seems to run perfectly and I can't seem to reproduce the conditions needed to cause any problems. Can you offer any general advise on a method to debug the problem? Perhaps running the program under the debugger might offer some insight anyway? Maybe there is a way to cause perl to print a stack trace if the process receives a SEGV signal or something?
In case you are curious, the program is the "port scan attack detector (psad)" which has recently been integrated with Bastille Linux, is released under the GPL, and is available here: http://www.cipherdyne.com