Alessandro de Manzano
demanzano at playstos.com
Tue Oct 13 09:07:58 EDT 2009
Graham Dumpleton wrote: > Apache/mod_python on UNIX is multi process and therefore requests > don't necessarily go back to the same process. Also, if using worker > MPM, that code isn't thread safe and so technically multiple threads > updating global variable at same time could not see it being > incremented as you expect. yes, I know, but eventually I should see a non-zero value, sooner or later. I tested about 100 requests and they reported always dummy=0 Apache currently spawns about 10 processes max so I'm quite sure the same unix process do process more than one http request, do invoke more than one time my handler function. > It is also possible for Apache processes to be recycled both at the > whim of Apache, but also explicitly if MaxRequestsPerChild is set to > be non zero in Apache configuration files. > > BTW, if you have PythonDebug set to On, then the error logs should > display messages about when mod_python loads or reloads mod_python > handler module files. it shows the module is "correctly" (re)loaded only once after file modified (for every apache process, of course), so it seems to me that already-loaded processes should maintain the value, it should simply invoke again the handler. But it seems instead if totally re-evaluate (!?) the module. Actually my dummy example was to understand apache+modpython inner workings, because in the real program I had to instantiate an "heavy" class (which connects to external DB, opens files, etc.) and I hoped to avoid to do it for each and every single request... thanks for answers bye Ale
|