-In the event of a bug caught by the DB worker, propogate it up to the client rather than having the client mysteriously hang
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4267 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
befc4743c4
commit
712cb4fb4d
@ -89,9 +89,16 @@ sub dbc_submit {
|
||||
print $clisock $data;
|
||||
$data="";
|
||||
my $lastline="";
|
||||
while ($lastline ne "ENDOFFREEZEQFVyo4Cj6Q0j\n") { #index($lastline,"ENDOFFREEZEQFVyo4Cj6Q0j") < 0) {
|
||||
while ($lastline ne "ENDOFFREEZEQFVyo4Cj6Q0j\n" and $lastline ne "*XCATBUGDETECTED*76e9b54341\n") { #index($lastline,"ENDOFFREEZEQFVyo4Cj6Q0j") < 0) {
|
||||
$lastline = <$clisock>;
|
||||
$data .= $lastline;
|
||||
$data .= $lastline;
|
||||
}
|
||||
if ($lastline eq "*XCATBUGDETECTED*76e9b54341\n") { #if it was an error
|
||||
#in the midst of the operation, die like it used to die
|
||||
my $err;
|
||||
$data =~ /\*XCATBUGDETECTED\*:(.*):\*XCATBUGDETECTED\*/s;
|
||||
$err = $1;
|
||||
die $err;
|
||||
}
|
||||
my @returndata = @{thaw($data)};
|
||||
if (wantarray) {
|
||||
@ -143,12 +150,25 @@ sub init_dbworker {
|
||||
$clientset->add($dbconn);
|
||||
}
|
||||
} else {
|
||||
handle_dbc_conn($currcon,$clientset);
|
||||
eval {
|
||||
handle_dbc_conn($currcon,$clientset);
|
||||
};
|
||||
if ($@) {
|
||||
my $err=$@;
|
||||
xCAT::MsgUtils->message("S","xcatd: possible BUG encountered by xCAT DB worker ".$err);
|
||||
if ($currcon) {
|
||||
eval { #avoid hang by allowin client to die too
|
||||
print $currcon "*XCATBUGDETECTED*:$err:*XCATBUGDETECTED*\n";
|
||||
print $currcon "*XCATBUGDETECTED*76e9b54341\n";
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if ($@) {
|
||||
xCAT::MsgUtils->message("S","xcatd: possible BUG encountered by xCAT DB worker ".$@);
|
||||
if ($@) { #this should never be reached, but leave it intact just in case
|
||||
my $err=$@;
|
||||
xCAT::MsgUtils->message("S","xcatd: possible BUG encountered by xCAT DB worker ".$err);
|
||||
}
|
||||
}
|
||||
close($dbworkersocket);
|
||||
|
Loading…
Reference in New Issue
Block a user