[mod_python] persistence in mod_python

Simon Bierbaum bierbaum at vierfalt.com
Wed Aug 20 17:43:03 EDT 2008


Thanks, Graham. From reading this and also http://www.dscpl.com.au/ 
wiki/ModPython/Articles/ModuleImportingIsBroken, I believe that two  
distinct requests, handled consecutively by the same unrecycled  
apache prefork child, will see the same global module objects and  
thus the same module state. Is that correct? I know this data sharing  
method should not be used, but it would mean the bug I'm hunting  
could be caused by some unintentionally left over state within a  
module, making the second request work with stale data.

Simon

Am 20.08.2008 um 22:43 schrieb Graham Dumpleton:

> For a start, read:
>
>   http://www.dscpl.com.au/wiki/ModPython/Articles/ 
> TheProcessInterpreterModel
>
> Graham
>
> 2008/8/21 Simon Bierbaum <bierbaum at vierfalt.com>:
>> Hi all,
>>
>> I would like to know exactly what bits in mod_python are  
>> persistent across
>> multiple requests to the same apache process. I.e., once apache is  
>> started
>> and mod_python is loaded, between two requests served by the same  
>> apache
>> process and the same Python handler,
>>
>> - does mod_python reload modules, i.e. is module initialization  
>> code only
>> run once during the apache process lifespan?
>> - is there a way for modules to store objects persistently, e.g. a  
>> database
>> connection pool?
>> - what happens to variables defined in the handler script but not  
>> locally
>> within the handler() function (I'm not sure whether this is what  
>> Python
>> calls "global")?
>>
>> I have a bug in my application which uses mod_python, MySQLdb and  
>> the InnoDB
>> storage engine revolving around transactions, and it's driving me  
>> mad...any
>> help or a pointer to documentation is greatly appreciated.
>>
>> Thanks, Simon
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>



More information about the Mod_python mailing list