re-importing modules
John Nagle
nagle at animats.com
Tue May 1 02:30:13 EDT 2007
Graham Dumpleton wrote:
> On May 1, 3:51 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
>
>>Graham Dumpleton <Graham.Dumple... at gmail.com> writes:
>>
>>>That it doesn't reload a parent when a child changes may be fine in an
>>>interactive debugger, but can cause problems if not done where
>>>automatic reloading is being done in a long running web application
>>>where you want to avoid server restarts.
>>
>>Oh that sounds horrid.
Er, yes.
> It may sound horrible but mod_python's original module importer had
> lots of problems because of things not being reloaded when they should
> have in a consistent manner. People weren't going to want to give up
> the reload feature altogether as restarting Apache all the time is
> viewed as a worse solution, so the only practical solution was at
> least make it reliable and this is one of the things that was required
> to do it. The number of complaints against mod_python module importing
> and reloading problems has basically vanished now with mod_python 3.3
> and the whole thing is so much more stable now.
>
> Do note that this reloading mechanism isn't applied across all Python
> modules, only mod_python handler and associated modules which are used
> within the context of URL/document space of your web server. Thus it
> is quite specialised and has quite specific use case scenarios which
> are well understood. In that context the whole mechanism works fine.
> Thus, please try not to pass judgment on it without full understanding
> the problem space it operates in and how it internally works. :-)
Ouch. This is one of those things where you start out with what
looks like a simple idea, but scaling it up introduces excessive
complexity. I'm impressed that somebody worked through that mess.
Could be worse, though. Imagine reloading, mod_python, and Twisted
all interacting during a software upgrade.
There's something to be said for the FastCGI approach. Restarts
and upgrades are handled in a straightforward manner. You're just
running a program over and over, without reloading, and every N minutes,
or when it's asked to do so, the program exits and is replaced by a
freshly loaded version. There's no reloading, just loading.
John Nagle
More information about the Python-list
mailing list