Python Module Threading Issue

Kwak Wookjong wookjong.kwak at thalesgroup.com
Thu Sep 5 23:07:14 CEST 2019


Hi Alan,

I recently upgraded FreeRadius server 3.0.16 to 3.0.19 and observed a performance issue on handling multiple thread.

I have done some research on this forum and found below discussion for Python Module Threading Issue about a year ago.
http://freeradius.1045715.n5.nabble.com/Python-Module-Threading-Issue-td5751186.html#a5751236<http://freeradius.1045715.n5.nabble.com/Python-Module-Threading-Issue-td5751186.html%23a5751236>

As a result of the discussion, it made one of the configuration value changed in rlm_python/rlm_pyton.c (line #1180) for 3.0.18 release.
https://github.com/FreeRADIUS/freeradius-server/commit/9a9e7852e52cab5323df87caca28a12f3459da88#diff-2744f0b518da3a53f09cbbbf449f14e9<https://github.com/FreeRADIUS/freeradius-server/commit/9a9e7852e52cab5323df87caca28a12f3459da88%23diff-2744f0b518da3a53f09cbbbf449f14e9>
module_t rlm_python = {
               .magic                  = RLM_MODULE_INIT,
               .name                   = "python",
-              .type                     = RLM_TYPE_THREAD_SAFE,
+             .type                     = RLM_TYPE_THREAD_UNSAFE,

and it looked like the change was made in case for using multiple python modules but the thing is,
in my case, within a single python module the multiple requests were treated as a single threaded.

I have confirmed such behavior with a simple test with using python module and example code provided in /etc/raddb/mods-config/python/example.py
by putting few seconds of delay for authenticate.

def authenticate(p):
  print "*** authenticate ***"
  time.sleep(5)
  return radiusd.RLM_MODULE_OK

Also confirmed, by putting back RLM_TYPE_THREAD_SAFE, multiple requests were handled by multi-threaded and the performance issue was resolved.

If it were needed to update RLM_TYPE_THREAD_UNSAFE for using multiple python module,
Can you, at least, make it configurable so that it can be set depending on the usage and situation?

Let me know,

Thanks!

Best Regards,
wj

________________________________
This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.


More information about the Freeradius-Users mailing list