[Python-Dev] RE: PyWX (Python AOLserver plugin)
Brent Fulgham
brent.fulgham@xpsystems.com
Tue, 12 Sep 2000 11:18:03 -0700
> Are you using separate interpreters or one interpreter with multiple
> threads? It sounds like the latter. If you use the latter than
> definately things like the process address space and the
> current working directory are shared across the threads. I don't
> think I understand your design. Can you explain the architecture
> of PyWX?
>
There are some documents on the website that give a bit more detail,
but in a nutshell we were using the Python interpreter thread concept
(Py_InterpreterNew, etc.) to allow 'independent' interpreters to
service HTTP requests in the server.
We are basically running afoul of the problems with the interpreter
isolation, as documented in the various Python embed docs.
"""Because sub-interpreters (and the main interpreter) are part of
the same process, the insulation between them isn't perfect -- for
example, using low-level file operations like os.close() they can
(accidentally or maliciously) affect each other's open files.
Because of the way extensions are shared between (sub-)interpreters,
some extensions may not work properly; this is especially likely
when the extension makes use of (static) global variables, or when
the extension manipulates its module's dictionary after its
initialization"""
So we are basically stuck. We can't link against Python multiple
times, so our only avenue to provide multiple interpreter instances
is to use the "Py_InterpreterNew" call and hope for the best.
Any hope for better interpreter isolation in 2.0? (2.1?)
-Brent