On 8 Dec 2017, at 02:53, Alan DeKok <aland@deployingradius.com> wrote:
On Dec 7, 2017, at 7:46 PM, Gary Gwin <garygwin@gmail.com> wrote:
If I reference the same python module from mypython1 and mypython2
python mypython1 { module = example ... }
python mypython2 { module = example ... }
Then FreeRADIUS initializes and functions properly.
Due to limitation in the Python interpreter, FreeRADIUS *cannot* instantiate multiple independent Python interpreters.
Any module you load has to be from one global Python module space / namespace.
However, if I use a different module for each, and in this test case a copy of same tested and functioning python program with a different name:
python mypython1 { module = example ... }
python mypython2 { module = example2 ... }
I get the following error initializing:
# Instantiating module "mypython2" from file /etc/freeradius/3.0/mods-enabled/mypython2 python_function_load - Module 'example2' not found <type 'exceptions.SystemError'> (null argument to internal routine) python_function_load - Failed to import python function 'example2.authorize' /etc/freeradius/3.0/mods-enabled/mypython2[2]: Instantiation failed for module "mypython2"
You should be able to load completely different Python modules, but they will both largely be running in the same interpreter.
In v3.0.x there should be different interpreter states which are swapped in and out depending on the thread and module instance. The states should be isolated from each other, so they should act like there are multiple interpreters even though there's only one. -Arran