[mod_python] globals, and MaxRequestsPerChild behavior: weird

David Geller dg at sponsera.com
Sat Nov 20 10:30:24 EST 2004


Hi,

I am setting a global dictionary (at the module level). Every time the
handler is executed, I check the global to see if it needs to be
initialized, and if so, I set it to some value.

If MaxRequestsPerChild (apache directive) is 0, or a large number, you
get what you would expect: the global needs to be initialized the first
time after an apache restart, and seldom on subsequent requests.

If I set it to 1, however, the same thing happens. I.e., it seems as if
the module is not being re-loaded for each request, which is what I
thought was the implication for MaxRequestsPerChild = 1.

However, if I set MaxKeepAliveRequests to 1 as well, then the global
needs to be initialized on *alternate* requests. I.e., first time, yes.
2nd time, no, etc.

Does anyone have an explanation for this? I am quite puzzled.

(this is for MPM = prefork (as far as I know), on linux, apache 2.0.48,
mod_python 3.1.3, python 2.3.4)

Thanks!

David Geller



More information about the Mod_python mailing list