rlm_python seems to run authorize function in a single thread

classic Classic list List threaded Threaded
2 messages Options
| Threaded
Open this post in threaded view
|

rlm_python seems to run authorize function in a single thread

Clint Lord
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.

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?

Here are the details of our runtime environment:

FreeRADIUS Version: 3.0.19
Python Version: 2.7.15

Please let us know if you need any additional environmental or configuration information.

We thank you in advance for any help you can provide.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: rlm_python seems to run authorize function in a single thread

Alan DeKok-2
On Jan 3, 2020, at 6:53 PM, Clint Lord <[hidden email]> 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.


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html