[mod_python] telling mod_python to exit its children

Martin Blais martin.blais at gmail.com
Sat May 21 09:52:35 EDT 2005


i've been working on a web app framework, and one of the
essential features that i need to work well is to be able to
simply save a new source file (while in debugging mode, set by a
flag in my config file) and for all the modules to be
appropriately reloaded (there is no way i would restart apache
everytime i change the code...).  i'm using lots of 3rd party
libraries and my code is spread out in many packages and modules,
so i found that the trivial reload approaches do not work well.

so thinking i was a smart cookie i've been fiddling quite a bit
and solved a lot of the problems and it pretty much works (but it
wasn't as easy as i thought), except for that occasional rare
case where something strange still happens (due to some residual
global state in the modules i didn't unload or what-not).  now i
could spend more time on that bug, but i've already spent a
considerable amount of time with this, and the solution is not
very clean anyway (fiddling with the sys.modules by hand...) and
i'm getting the feeling that taking a lower-level approach might
just be cleaner and easier.

Some questions:

1. in a handler, is there a way to tell apache to exit the child
   currently handling the request and to rerun the request it
   another/a new child?

2. or is there a way to tell apache to exit all its pool of
   children, so that new request only get handled by new/fresh
   child processes?

I saw REQ_EXIT in apache.py, but it doesn't appear anywhere else
in the code, and is marked legacy.  Also, according to the
documentation, returning DECLINED doesn't appear to indicate that
apache will retry the same handler on a different child, but
I may be reading wrong.

any pointers appreciated.


More information about the Mod_python mailing list