Using the authenticate function on rlm_python
Francis Augusto Medeiros-Logeay
r_f at med-lo.eu
Fri Nov 15 13:17:56 UTC 2024
> On 15 Nov 2024, at 13:37, Alan DeKok <aland at deployingradius.com> wrote:
>
>> I was wondering if there’s any example on how to handle threads here.
>
> No. The server has it's own thread pool. You shouldn't start new threads in Python.
Thanks Alan!
Before reading your message, I tried with threads, and it seemed better to handle my specific situation, but I don’t want to do anything that’s non-kosher here. I just thought it was ok to use threads here due the reference to threading.local() on the documentation.
>> The thing is that I’ll be using python there to handle push notifications, which might be blocking. I’m not being able to have concurrent authentication requests. according to the documentation, threading seems to be supported, but I can’t figure out how.
>
> If the API is blocking, there is very little you can do to fix that. The server *must* wait for the reply, which means... waiting for the reply.
>
> The only solution here for v3 is to increase the number of threads in radiusd.conf. See "thread pool". Set the maximum to a large number, like 100, or even more if you need it. The only negative side effect is that the server will use more memory.
That’s the thing: I have the default configuration, which is five servers. But even a second connection doesn’t execute concurrently. If the first hangs, the second still waits. Is there any configuration for the python module to make it more compliant to this?
What I am trying here is to emulate a bit the behaviour of the NPS radius, which handles push notifications. Those are blocking, so I don’t want to return `OK` before the user has approved the authentication on his mobile.
Best,
Francis
More information about the Freeradius-Users
mailing list