diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 772aadca4..c58f698ed 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -1702,20 +1702,23 @@ sub service_connection { my $request; my $req=undef; my $line; - my $flags=fcntl($sock,F_GETFL,0); - $flags |= O_NONBLOCK; #we want sysread to bail on us, select seems to be evil to us still.. - fcntl($sock,F_SETFL,$flags); my $clientsel = new IO::Select; $clientsel->add($sock); while (1) { $line=""; unless ($clientsel->can_read(15)) { last; } #don't let an unresponsive client hold us up + my $flags=fcntl($sock,F_GETFL,0); + $flags |= O_NONBLOCK; #we want sysread to bail on us, select seems to be evil to us still.. + fcntl($sock,F_SETFL,$flags); my $bytesread; do { $bytesread=sysread($sock,$line,65536,length($line)) } while ($bytesread); if (length($line)==0) { if (not defined $bytesread and $! == EAGAIN) { next; } # last; } + my $flags=fcntl($sock,F_GETFL,0); + $flags &= ~O_NONBLOCK; #now we want *print* to be blocking IO + fcntl($sock,F_SETFL,$flags); $request .= $line; #$req = eval { XMLin($request, ForceArray => [ 'attribute' , 'attributepair' ]) }; if ($line =~ m/<\/xcatrequest>/) {