[mod_python] deadlock when using mod_python + simplified GIL - e.g. swig wrapper of xapian (MODPYTHON-217)

Graham Dumpleton graham.dumpleton at gmail.com
Sun Apr 27 17:34:52 EDT 2008


2008/4/28 Herbert Poul <herbert.poul at gmail.com>:
> hi,
>
>  i stumbled across a problem which has been reported a year ago called
>  "Python 2.3 and simplified GIL state API still causes problems.":
>  http://issues.apache.org/jira/browse/MODPYTHON-217
>  and wondered if there are any plans to fix it or any known workarounds.
>
>  in short: i am trying to get the python wrapper of xapian (based on
>  swig, which in turn uses simplified GIL api) working in mod_python -
>  but every call to this C extension ends in a deadlock.
>
>  it seems this problem arises because of the combination of mod_python
>  using PyEval_AcquireLock and the SWIG wrapper using simplified GIL
>  (PyGILState_Ensure)
>
>  is this actually anything that needs fixing in mod_python, or in the
>  python wrapper/SWIG ?
>  i would appreciate any pointers. (i have already tried using
>  'PythonInterpreter main_interpreter' but it doesn't help)

Yes, mod_python needs fixing. It needs to detect when main interpreter
being used and use simplified GLI state API methods instead of
traditional thread state API.

Is your Python web application specifically written to mod_python API
or are you using some sort of web framework that uses WSGI as server
interface. If WSGI capable, you can use mod_wsgi instead, which
doesn't have this problem, although you still need to force web
application to run in main interpreter.

Graham


More information about the Mod_python mailing list