(RADIATOR) cpu-hog bug in AuthRADIUS.pm
Damir Dzeko
damir.dzeko at iskon.hr
Fri Dec 14 08:11:51 CST 2001
Hello,
I noticed a cpu-hog bug in radiator which caused it to use up
all available cpu power to run these system calls in a loop:
poll(0xFFBEF678, 1, 1000) = 1
recvfrom(8, 0x009163F0, 8192, 0, 0xFFBEF338, 0xFFBEF330) Err#9 EBADF
time() = 1008323763
I traced the problem and found a loop in AuthRADIUS.pm that
calls select and does not check it's return value properly.
Here is the diff-output of changes I've made to original
AuthRADIUS.pm. Maybe it's not all correct but it at least
solves the cpu-hog problem.
--- AuthRADIUS.pm,orig Fri Dec 14 13:44:21 2001
+++ AuthRADIUS.pm Fri Dec 14 15:05:54 2001
@@ -248,16 +248,21 @@
# will be handled: If the remote server is down
# you may get a serious performance hit
# Wait for activity on the reply socket or timeouts
- my ($waitfor, $found);
+ my ($waitfor, $found, $err_in, $err_out);
vec($waitfor, fileno($self->getSock()), 1) = 1;
+ $err_in = $waitfor;
delete $p->{RadiusResult};
while (! defined $p->{RadiusResult})
{
# Wait up to a second for activity on the socket
- select($found=$waitfor, undef, undef, 1)
- && &handle_radius_socket_read
- (fileno($self->getSock()),
- $self->getSock());
+ select($found=$waitfor, undef, $err_out=$err_in, 1);
+ # ddzeko added error check
+ if ($err_out) {
+ $self->log($main::LOG_DEBUG, "AuthRADIUS: network error");
+ return ($main::REJECT, 'Network error');
+ } elsif ($found) {
+ &handle_radius_socket_read(fileno($self->getSock()), $self->getSock());
+ }
&Radius::Select::process_timeouts();
}
return ($p->{RadiusResult});
===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.
More information about the radiator
mailing list