Skip to content

Commit 70d6e7f

Browse files
xuweibjrobin2008
authored andcommitted
if not get valid pid when waitpid, sleep (#5274)
1 parent be93422 commit 70d6e7f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

xCAT-server/lib/xcat/plugins/openbmc.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,8 +1088,10 @@ rmdir \"/tmp/\$userid\" \n";
10881088
}
10891089

10901090
if (%child_node_map) {
1091+
my $pid_flag = 0;
10911092
while ((my $cpid = waitpid(-1, WNOHANG)) > 0) {
10921093
if ($child_node_map{$cpid}) {
1094+
$pid_flag = 1;
10931095
my $node = $child_node_map{$cpid};
10941096
my $rc = $? >> 8;
10951097
if ($rc != 0) {
@@ -1107,6 +1109,9 @@ rmdir \"/tmp/\$userid\" \n";
11071109
delete $child_node_map{$cpid};
11081110
}
11091111
}
1112+
unless ($pid_flag) {
1113+
select(undef, undef, undef, 0.01);
1114+
}
11101115
}
11111116
my @del;
11121117
while (my ($k, $v) = each %node_wait) {

0 commit comments

Comments
 (0)