Trouble (rlm_python) with grpcio.

Alan DeKok aland at deployingradius.com
Tue Apr 27 11:57:47 CEST 2021


On Apr 27, 2021, at 3:03 AM, s malinskiy <s.malinskiy at gmail.com> wrote:
> Several days ago I tried to use grpc for authentication in the python3
> module, but
> my request to the backend service failed.
> That was pretty strange and I spent some time troubleshooting the problem.
> 
> First, all works well if I call script from *instantiate* section, but for
> case if i try use call for example
> in *authentication,* nothing happens (grpc constantly tries to reach
> backend service) and radiusd stops proceeding new authentication requests.
> I think there is some kind of threading issue of python.

  The data in the python module is thread-local.  When it runs in the "instantiate" section, it's in one thread.  When it runs in the "authenticate" section, it's another thread.

  This means you can't really "cache" variables in one method, and expect to see them in another method.  It just doesn't work that way.  Instead, treat each call to Python as starting up a completely new script.

  Python is also single-threaded, due to it's global interpreter lock.  So using Python code will slow the server down enormously.

  There are very few reasons for running an interpreted language in FreeRADIUS.  The built-in modules do enormous amounts of things, and they do it very well.

  Alan DeKok.




More information about the Freeradius-Devel mailing list