Subject: | App::Control enters endless loop if started script dies on startup |
Test case: let App::Control start a script that just exits on startup.
App::Control enters the contol loop, and tries to determine if the
process is running, which of course it is not. Whenever the LOOP count
is reached, App::Control tries to kill the process, but only if it can
send a signal to it, which it cannot, beause the process is dead
already. Therefore App::Control also does not call exit() in the
controlling process and stays in the (endless) loop.
Suggestion: always call exit() if the LOOP count was reached, no matter
if the child process is alive or not.
Thanks for considering!
This is the endless loop:
while( not $self->running )
{
warn $self->status if $self->{VERBOSE};
sleep( $self->{SLEEP} );
warn "is $self->{EXEC} ruinning (${loop}'th time)?\n"
if $self->{VERBOSE} and $loop
;
if ( defined $self->{LOOP} and $loop++ == $self->{LOOP} )
{
warn "Failed to start $self->{EXEC}\n"
if $self->{VERBOSE}
;
if ( kill( 0, $child ) )
{
warn "killing $child ...\n" if $self->{VERBOSE};
kill( 'KILL', $child );
exit;
}
}
}