[mod_python] Session problem

Graham Dumpleton grahamd at dscpl.com.au
Wed Nov 22 19:52:26 EST 2006


Bouncing this back to the list again. :-)

On 11/22/06, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
> Jakub Labath wrote ..
> > > > What I found weird is that the same mod_python request serviced two
> > > > different clients at different times, but perhaps that makes sense
> > for
> > > > preforked apache.
> > >
> > > Just to clarify your terminology, it is the same mod_python *instance*
> > > servicing 2 different client requests. And no, it is not weird, but
> > > rather the whole point of mod_python. Well maybe not the *whole* point,
> > > but a very important one. :) In the simplest case you get one python
> > > interpreter per apache child process, thus avoiding the overhead of
> > > creating a new interpreter for each request.
> >
> > It was the same child process (that much makes sense too me too), but
> > it also had the same address for modpython request object. Which I
> > thought is little weird since if request comes from address A it
> > should not be the same as if it comes from address B.
> > But the python id is just a memory address so it is possible that it
> > was just reusing the same memory space.
>
> You could always print out:
>
>   req.connection.id
>   req.connection.remote_addr

I'll try this in my debugging output, thanks.

>
> It is possible that the connection ID might get reused, but if the remote
> address is the same for both requests, then you would really worry.
>
> > > A little light just went off in my head. Is it always *exactly* the same
> > > session id being served up for *all* requests?
> >
> > No 99% of the time all work works normally.
> > User A comes along gets his own cookie user B comes along gets her own
> > cookie ... and then in one moment user A gets the cookie that belongs
> > to user B. While B user still gets her own cookie. Then user A notices
> > that suddenly his username changed from Joe to Suzy and starts sending
> > rather angry emails, which I cannot really blame him for.
> > The problem seems to appear more often if the site is under heavier load.
>
> Do both clients make requests to the server via any sort of proxy or otherwise
> which could be caching pages? In your pages do you do anything to try and
> manipulate how pages might be cached?
>
> Graham
>

Nothing I know of I suspected something doing it behind my back, but
it happens on two different boxes in two different locations, to
different clients.
I think I will find/write a tool that can emulate users loging in and
out. Once I have more reliable way to reproduce the error I will know
more.
Thanks for help everybody.

-- 
Jakub Labath


More information about the Mod_python mailing list