rexec, threads, and ugly crashes

Danyel Fisher danyelf at pupienus.ics.uci.edu
Thu Apr 19 23:11:13 EDT 2001


I'm in a multi-threaded application--a socket server--that is executing 
arbitrary incoming code. Needless to say, I'm trying to be careful. I
want to restrict my visitors to calling things from an API that I 
provide.

RExec is my tool.

The other day, I wrote up a test script that just demo'd the use of
rexec accessing a module, and was quite happy.

Then I put it into my code:

   def action( actionCall ):
	import rexec
	exec_env = rexec.RExec()
        ...
        exec_env.r_exec( actionCall )

and it dies with the cryptic error message "Interpreter not
initialized."

Sadly, an online search doesn't show much, except that it (used to?)
happen with 1.5 modules used by 2.0 apps. I don't THINK my rexec is an
outdated version.

bash-2.04$ python -v mainmodule
Python 2.0 (#4, Apr 11 2001, 12:50:56) 
[GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2
...
# /usr/local/lib/python2.0/rexec.pyc matches \
/usr/local/lib/python2.0/rexec.py
import rexec # precompiled from /usr/local/lib/python2.0/rexec.pyc
# /usr/local/lib/python2.0/ihooks.pyc matches \
/usr/local/lib/python2.0/ihooks.py
import ihooks # precompiled from /usr/local/lib/python2.0/ihooks.pyc
import imp # builtin
Fatal Python error: Interpreter not initialized (version mismatch?)
Aborted (core dumped)

Has anyone seen something like this before? What do I want to fix?

--Danyel



More information about the Python-list mailing list