cbolcato has asked for the wisdom of the Perl Monks concerning the following question:
I haven't been able to re-create the failure with test code, and I cannot post production code, but $? >> 8 = 16777215 for SCRIPT1 while SCRIPT2 is still running.
The following line of code were executed immediately after the system() and produced the out put below:
Oh, did I mention that it does not fail everytime!!
The following code was added and return the results stated below:
if ($? == -1) { print "failed to execute: $!\n"; } elsif ($? & 127) { printf "child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without'; } else { printf "child exited with value %d\n", $? >> 8; } $exit_value = $? >> 8; $signal_num = $? & 127; $dumped_core = $? & 128; print "$?\n"; print "$exit_value\n"; print "$signal_num\n"; print "$dumped_core\n"; print "$!\n";
failed to execute: Illegal seek
16777215
127
128
child exited with value 127
Problem Solved
The suggestion made by bluto that SCRIPT1 may be getting signaled got me thinking and testing along that path.
What I found is that SCRIPT2 wasn't sending a signal, but SCRIPT1 had an alarm set that would trigger the updating of a timestamp in a logfile.
If that alarm tripped while SCRIPT1 was waiting for a return from the system() call, control would come back to SCRIPT1 prior to SCRIPT2 completing, thus causing our failure condition.
Once, I identified the problem I have been able to re-create this senario in test.
The resolution was to turn the alarm off "alarm(0);" prior to performing the system() call.
Thanks, to all who responded. cbolcato
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: system() does not wait
by ikegami (Patriarch) on Nov 30, 2005 at 20:42 UTC | |
by cbolcato (Novice) on Nov 30, 2005 at 20:45 UTC | |
Re: system() does not wait
by GrandFather (Saint) on Nov 30, 2005 at 20:45 UTC | |
by cbolcato (Novice) on Nov 30, 2005 at 20:51 UTC | |
by GrandFather (Saint) on Nov 30, 2005 at 20:58 UTC | |
Re: system() does not wait
by fizbin (Chaplain) on Dec 01, 2005 at 01:23 UTC | |
Re: system() does not wait
by Roy Johnson (Monsignor) on Nov 30, 2005 at 20:54 UTC | |
Re: system() does not wait
by bluto (Curate) on Nov 30, 2005 at 22:41 UTC | |
by cbolcato (Novice) on Dec 01, 2005 at 13:39 UTC | |
by cbolcato (Novice) on Dec 01, 2005 at 13:41 UTC | |
by fizbin (Chaplain) on Dec 01, 2005 at 15:29 UTC | |
Re: system() does not wait
by fizbin (Chaplain) on Dec 01, 2005 at 20:52 UTC | |
by cbolcato (Novice) on Dec 02, 2005 at 13:09 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |