[mod_python] Session Hanging Problems

David Janes davidjanes at blogmatrix.com
Tue Dec 4 14:16:31 EST 2007

We've had no problems so far, but I'd like to keep it in for awhile to
see if any problems occur before staking my reputation on it ;-)

Note that it's running on 3 sites:

In terms of the locking logic, we just override all the lock functions
and implement them exactly the same way the base classes do (see
earlier code sample). Note that we _always_ explicitly unlock our
sessions, just because.

Definitely a Linux solution, though perhaps something like this would work:

if os.flock:
 ... do flock stuff ...
  super.original_lock_code(self, ...)

Regards, etc...

On Dec 4, 2007 12:28 PM, Harish Agarwal <harish at octopart.com> wrote:
> Have you noticed any performance issues?  I want to make sure to keep
> things fast and am worried that departing from the Apache lock system
> will degrade performance.  Why was mod python designed to use the
> apache system and not use session specific locks?
> Also a note for the list - I'm now explicitly unlocking the session
> after each save to ensure that the session isn't locked during a
> req.write call.  I've seen one hang since then, but in twelve hours,
> that is much much better than the issues I was seeing before.
> I think that this problem directly contradicts the general philosophy
> behind using the mod_python session handling scheme - I feel like I've
> read, a few times now, that there is no reason to have to explicitly
> unlock sessions, but this is an instance where running everything in
> its default configuration (not unlocking sessions, flushing the buffer
> on req.writes) causes serious hanging problems...  In addition,
> unlocking the session after each save doesn't sit well with me - I
> don't think the session is thread-safe now (given that there can be
> multiple save's per request).
> -Harish
> On Dec 4, 2007, at 1:48 AM, David Janes wrote:
> > I'll note for the list that I put in the changes I outlined above ---
> > that is, handled locking entirely ourselves rather than using Apache's
> > lock function -- and I haven't had a hang since.
> >
> > Regards, etc...
> >
> > --
> > David Janes
> > Founder, BlogMatrix
> > http://www.blogmatrix.com
> > http://blogmatrix.blogmatrix.com
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python

David Janes
Founder, BlogMatrix

More information about the Mod_python mailing list