Skip to content

Commit

Permalink
Fix rlm_python3 dead-lock in GIL. ref FreeRADIUS#5111
Browse files Browse the repository at this point in the history
... Limiting to have more than one instance
  • Loading branch information
jpereira committed Jul 24, 2023
1 parent 0532fa9 commit d5b1f36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ FreeRADIUS 3.2.4 Fri 26 May 2023 12:00:00 EDT urgency=low
canonical attribute
* Make FreeRADIUS-Server-EMA* attributes work again for home server
exponential moving average statistics.
* Fix rlm_python3 dead-lock in GIL limiting to have more than one instance. Fixes #5111

FreeRADIUS 3.2.3 Fri 26 May 2023 12:00:00 EDT urgency=low
Configuration changes
Expand Down
4 changes: 2 additions & 2 deletions src/modules/rlm_python3/rlm_python3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,8 @@ static int python_interpreter_init(rlm_python_t *inst, CONF_SECTION *conf)
Py_InitializeEx(0); /* Don't override signal handlers - noop on subs calls */
PyEval_InitThreads(); /* This also grabs a lock (which we then need to release) */
main_interpreter = PyThreadState_Get(); /* Store reference to the main interpreter */
PyEval_SaveThread(); /* Unlock GIL */

}
rad_assert(PyEval_ThreadsInitialized());

Expand Down Expand Up @@ -1204,8 +1206,6 @@ static int python_interpreter_init(rlm_python_t *inst, CONF_SECTION *conf)
Py_IncRef(inst->pythonconf_dict);
}

PyEval_SaveThread();

return 0;
}

Expand Down

0 comments on commit d5b1f36

Please sign in to comment.