Hello Damir, thanks for this patch. I have rolled it in (with some minor changes) for the next release. We really appreciate your contributions.
Cheers. > ---------- Forwarded Message ---------- > > Subject: (RADIATOR) cpu-hog bug in AuthRADIUS.pm > Date: 14 Dec 2001 15:11:51 +0100 > From: Damir Dzeko <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > > 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 [EMAIL PROTECTED] > To unsubscribe, email '[EMAIL PROTECTED]' with > 'unsubscribe radiator' in the body of the message. > > ------------------------------------------------------- -- Mike McCauley [EMAIL PROTECTED] Open System Consultants Pty. Ltd Unix, Perl, Motif, C++, WWW 24 Bateman St Hampton, VIC 3188 Australia http://www.open.com.au Phone +61 3 9598-0985 Fax +61 3 9598-0955 Radiator: the most portable, flexible and configurable RADIUS server anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald, Platypus, Freeside, TACACS+, PAM, external, Active Directory etc etc on Unix, Win95/8, 2000, NT, MacOS 9, MacOS X === Archive at http://www.open.com.au/archives/radiator/ Announcements on [EMAIL PROTECTED] To unsubscribe, email '[EMAIL PROTECTED]' with 'unsubscribe radiator' in the body of the message.