Commit 5ce7a159 authored by Mike Hibler's avatar Mike Hibler
Browse files

Run the controller status fetches in a child process so we can timeout.

parent 51ea27cd
...@@ -134,7 +134,25 @@ sub dostatus(@) { ...@@ -134,7 +134,25 @@ sub dostatus(@) {
# #
# Loop through desired controllers getting status # Loop through desired controllers getting status
# We do this in a child process so we can time it out if
# one of the controllers is not responding.
# #
my $syspid = fork();
if ($syspid) {
#
# Allow 5 seconds per controller
#
local $SIG{ALRM} = sub { kill("TERM", $syspid); };
my $to = 5 * scalar(@wanted);
alarm $to;
waitpid($syspid, 0);
alarm 0;
if ($?) {
logit("*** Status fetch failed after $to seconds with exit val $?");
}
return $?;
}
for my $ctrl (@wanted) { for my $ctrl (@wanted) {
my %status; my %status;
...@@ -169,7 +187,7 @@ sub dostatus(@) { ...@@ -169,7 +187,7 @@ sub dostatus(@) {
$errors++; $errors++;
} }
} }
return $errors; exit($errors);
} }
sub logit($) { sub logit($) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment