rlm_python seems to run authorize function in a single thread
Alan DeKok
aland at deployingradius.com
Sat Jan 4 01:11:55 CET 2020
On Jan 3, 2020, at 6:53 PM, Clint Lord <clint at voodoocube.com> wrote:
>
> We've created a python module that we use to process authorization requests (ie. func_authorize). Each call to the authorize method seems to block any subsequent calls until it completes, then it moves on the next one. In other words it’s processing them one at a time. This is not the behavior we were expecting since rlm_python is set to RLM_TYPE_THREAD_SAFE.
The underlying Python interpreter is not thread safe. The rlm_python module has been marked RLM_TYPE_THREAD_UNSAFE for over a year.
> We’ve done some research on this and found a post from 2015 (referencing FreeRADIUS 2.X) in which someone was complaining about a similar issue, and someone responded that rlm_python is not thread safe in FreeRADIUS 2.X. Could someone here help us understand the expected threading behavior of rlm_python in FreeRADIUS 3.0.19? Is there some way to configure FreeRADIUS, rlm_python or the Python runtime to enable calling the authorize function in a multithreaded fashion?
The Python interpreter is not thread-safe. See the Global Interpreter Lock (GIL) in Python.
> Here are the details of our runtime environment:
>
> FreeRADIUS Version: 3.0.19
The rlm_python.c module in 3.0.19 is marked RLM_TYPE_THREAD_UNSAFE .
> Python Version: 2.7.15
Python 2.7 is not thread safe.
If you want a thread-safe interpreted language, see rlm_perl.
Alan DeKok.
More information about the Freeradius-Users
mailing list