quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory (Grisha) Trubetskoy" <gri...@apache.org>
Subject Re: Initializing the interpreter in python_init() instead of python_handler()
Date Mon, 16 Sep 2002 20:02:05 GMT

[removed mod_python@modpython.org, this is too deep for it IMO]

On Mon, 16 Sep 2002, Jack Diederich wrote:

> I just threw some of the python_handler() code into python_init() and it works!
>
> This means that it is possible to do all the imports etc only once,
> instead of once per child.

The main the problem with this is that python_init(), which executes as a
post_config hook, runs as root. Technically speaking this is MPM-specific,
but at least looking at prefork, the sequence of events is:

	post_config
	...
	fork
	setuid
	run_child_init

So child_init is the earliest non-root execution.

Yes, you can import things once, but do you want to run a risk of some
Python script reeking havoc on your system as root?

I'm not sure what mod_perl does, probably just runs as root, which is
riskier than I would like.

Grisha


Mime
View raw message