[mod_python] Please help me :)

Ondrej Sury sury.ondrej at globe.cz
Mon May 19 14:35:55 EST 2003


mod_python at mikebell.org writes:

> On Fri, May 16, 2003 at 02:43:17PM -0700, Michael Gibbs wrote:
>> Our problem is that we are trying to maintain a counter using a global 
>> variable. However the script returns different values when multiple browser 
>> form requests are being submitted. The counter seems to get changed by 
>> different requests but not as expected. Are we doing something wrong?
>
> Your global variables will only be shared by requests handled by the
> same interpreter. Each apache process forked has its own. You need to
> use some form of shared memory to get multiple processes to share a
> counter, be it by mmaping a file or using a database connection or
> whatever.

I had some success when using threaded mpm model (per_child f.e.) in apache 2.x
which starts only on python interpreter for all threads in the same process group.

O.

-- 
Ondrej Sury - co/CTO                Globe Internet s.r.o. http://globe.cz/
Tel: +420(2)35365000 Fax: +420(2)35365009     Planickova 1, 162 00 Praha 6


More information about the Mod_python mailing list