Logging Perl-probe CrashesSo you've written your first probe, sent it out into the world and everything is wonderful. The next day, you discover the probe is restarting and it isn't clear why. What to do? Log the crash!sub run {
eval { run_code(); };
if ( $@ ) {
nimLog( 0, "PROBE CRASHED: $@" );
die;
}
}
The idea is to run your actual probe code within an eval{}; call. This allows us to catch the exceptions/errors like "Can't call method "0" on unblessed reference at ./my_buggy_probe.pl line 229.".
Still Experiencing Unknown Restarts?
In certain cases, the controller will restart your probe. What I've been told is that it is after your probe fails to respond to 4 _status callback requests with each having a timeout of 15 seconds. I don't know if these are back to back requests or have some sort of retry function that backs off on failure. With the logging method above, you'll be able to determine if it is your code or something else causing the probe to restart.
References:
perlfunc/eval