Wednesday, March 30, 2011

authentication switching mid-session

When my Django system is under heavy load (system CPU > 90%), I start
getting complaints from users that their authentication changes in the
middle of a session. For example:

1) Bob logs in to the site. The site says "Hello Bob" at the top of
each page.
2) Bob uses the site for a while without incident
3) Bob notices that the top of the page now says "Hello Steve".

The problem is intermittent, and I can't duplicate it (but I have seen
it with my own eyes). I'm running Django 1.2.5 on Windows, with
SessionMiddleware installed. I have django.contrib.sessions in my
INSTALLED_APPS, and I believe that I'm using database-backed sessions,
with a MySQL database.

The only "odd" thing that I'm doing is that I have four instances of
Apache running, with my Django app running via mod_wsgi in each of
them. There is another apache server in front that does load-
balancing, so multiple requests from a single user may get routed to
different apache instances (which is what I want, to get maximum
throughput on Ajax calls). But I thought that having the sessions be
database-backed would deal with this (multiple session requests can
hit the database at the same time).

Any thoughts? I'm sorry this is such a lousy, unrepeatable case.

P.S. I have looked at,
which says that this issue has been fixed, but I can't tell if this is
the same issue or not.

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment