Hi Fellow Monks,
I'm a windows perl user, and have a script thats configured as a scheduled task (I'm unable to configure it as a win32 service at present).
The problem I'm facing is that my script (seemingly) randomly recieves INT or QUIT signals, and I don't know where they are coming from...
1. If possible, would someone mind replying with a piece of code that I can add to my signal handler that will trace where the signal came from?
2. If I choose to ignore these signals, what risks should I be aware of. And can I rely on a SIGKILL to terminate the script.
Appreciate any help.
Cheers,
Des
Update:
Well, I cannot say for certain, but I'm still 99% sure of the following based on my testing:
Under windows, Perl ignores SIGQUIT (even the fake QUIT that it seemingly generates itself). Potentially due to my signal handler fidling with things. (I should of posted this before, sorry) In one sense, this handler 'upgrades' all signals to die... which I wanted initially when I was trying to locate the source of the signals.
use sigtrap qw(handler SIG_handler any normal-signals any error-signal
+s);
####
sub SIG_handler {
my($signal) = @_;
my $filename = 'signals.log';
my $num = threads->tid();
my $timestamp = scalar localtime(time);
open (my $LOGFILE, ">>", $filename);
print {$LOGFILE} "==$timestamp==\nThread $num caught/received a Si
+gnal: [$signal]";
print {$LOGFILE} "\n\n\n";
close ($LOGFILE);
die "$signal";
}
Admittedly I had at least 2 issues, one of which was a module croaking on me, which I eval'd as a workaround. Took me a while to find. But the SIGQUIT issue remained.
I got the idea to set up multiple scheduled task service scripts that log what signals they recieve using essentially the same handler as above.
I found that the scheduled tasks configured with the run command as "c:\perl\bin\perl.exe script.pl" were getting the SIGQUIT signals (even at the same time ?!?), while the scipts configured as "E:\SigQUIT_Finder\script.pl" weren't recieving any signals. Who knows why - maybe theres some strange microsoft reason .
hope thats not too much waffle - I wanted to post my results in case any other unfortunate soul runs into the same headaches I did... And if anyone does, feel free to msg me and I'll assist as best I can.