radiusclient thread-safety

Alex Massover alex at jajah.com
Thu Feb 25 20:55:33 CET 2010


Hello,

I'm using radiusclient lib from multithreaded application, by having a "static rc_handle *rh" and calling rc_auth() from different threads.

Everything works until 2 (or more) threads enter rc_auth() before the previous one finished. But 2 concurrent threads enough to corrupt everything, I'm starting to get "received invalid reply digest..." followed by "no reply from RADIUS server" for subsequent calls.

I changed rc_check_reply() to return OK at the beginning, it eliminated "received invalid reply", but I still get "no reply from RADIUS server ...".

In wireshark trace it looks like there's no problems with responses, every request receives response (and before timeout should happen).  It looks like something logical, shared or static buffer maybe.

I'm looking in the code and can't find the problem :( I changed localtime to localtime_r, gmtime to gmtime_r, rand to rand_r, but still have a problem.


In the trace:
->request
<-response
->request
<-response

Works well, but looks like enough to have:
->request
->request
<-response
<-response
 
To cause most of (not every) following subsequent request to get "no reply..." although there're responses in the trace.

Also my distro has old radiusclient-ng and not freeradiusclient, but as far as I understood there's no difference in this section.

Can someone enlighten me on the subj please?

--
BR,
Alex.

This mail was sent via Mail-SeCure System.






More information about the Freeradius-Devel mailing list