Reemission bug in multi-threaded mode - FreeRADIUS does not wake up properly

Chaigneau Nicolas chaigneaun at yahoo.fr
Tue Nov 7 11:31:45 CET 2006


FreeRADIUS 1.1.3 - Reemission bug in multi-threaded mode - FreeRADIUS does not wake up properly


When receiving a request to proxy, FreeRADIUS should wake up in (at most) the proxied request retransmission delay parameter.

This does not work.

Note that in the case of the NAS reemitting the request, the problem does not appear, because when receiving new requests, FreeRADIUS wakes up and process its request list.

The problem happens when a request is received, the request has to be proxied, but the NAS does not reemit (and no other request is received by FreeRADIUS from any NAS).



The "wake up" delay is then set to 31 (probably max_request_time + 1) seconds instead of 5 (retry_delay), as we can see in debug mode:

rad_recv: Accounting-Request packet from host *****:16384, id=233, length=53
Mon Nov  6 15:11:57 2006 : Debug: --- Walking the entire request list ---
Mon Nov  6 15:11:57 2006 : Debug: Thread 4 got semaphore
Mon Nov  6 15:11:57 2006 : Debug: Waking up in 31 seconds...
Mon Nov  6 15:11:57 2006 : Debug: Thread 4 handling request 3, (1 handled so far)

The behaviour is the same in normal (non debug) mode : the proxy server does only receive the request once, thus FreeRADIUS is not reemitting.



In function refresh_request of file request_list.c, we should pass in the following condition :

if (request->proxy && !request->proxy_reply) { ...

(ie, request unfinished, but has been proxied and we are waiting for response from proxy server)

It seems the condition is not met, so the next condition (ie, request unfinished but no proxy) is fulfilled. Thus, FreeRADIUS computes the time difference with:

difference = (request->timestamp + mainconfig.max_request_time) - info->now;




If FreeRADIUS is launched in single-thread mode (-X), the problem does not occur.


It seems that "request->proxy" is 0 when the condition is tested, thus, FreeRADIUS considers there is no proxy outstanding for this request.

From what I understand, when receiving a request, the thread that handles the list of requests wakes up, process its list and goes back to sleep. This thread finishes its work *before* the thread handling the request has proxied the request.

This is the cause of the problem described above.



Any hint as how to fix this ? (the problem is not critical: it appears on a test environment but will not happen in production, as a RADIUS server receives lots of requests)

Should I log this in bugzilla ?


Thanks.


Best regards,
Nicolas.







	

	
		
___________________________________________________________________________ 
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20061107/58b262e2/attachment.html>


More information about the Freeradius-Devel mailing list