FreeRadius 3.0.3 module thread safety

Dejan Markic Dejan.Markic at mobik-ics.com
Tue Oct 14 15:36:46 CEST 2014


Hello!

I've written a module for FreeRadius currently running on version 3.0.3. I must admit, I have a very limited understanding about the thread safety in regards to modules.
I register module as RLM_TYPE_THREAD_SAFE and in my instantiate function I load several MySQL database instances and some other instances. So they are all in rlm_MYMODULE_t instance stuct.
Do I understand correctly, that if RLM_TYPE_THREAD_SAFE is used, this module instance struct might be used in different threads even tough I define only 4 instances, and 4 instances are created?
So to put it in another way, I have four instances that might be used by 8 threads simultaneously?
I now protect each instance with a mutex and sometimes it happens, that one instance gets  the reply from our service with a bit of delay and then that instance mutex stays locked for >0.2 second and an avalanche effect occours. I guess three instances are working normaly, but one gets slowed down with each additional request, since it waits for that same mutex. Is that correct?

Thank you very much for your replies.

Kind regards,
Dejan Markic


More information about the Freeradius-Users mailing list