quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Lehuen <nicolas.leh...@gmail.com>
Subject Re: FileSession - a couple of small fixes
Date Tue, 12 Apr 2005 06:53:14 GMT
On Apr 12, 2005 8:19 AM, Nicolas Lehuen <nicolas.lehuen@gmail.com> wrote:
> On Apr 12, 2005 6:48 AM, Jim Gallacher <jim@jgassociates.ca> wrote:
> > I've made a couple of small changes to FileSession.
> >
> > 1. _fast_timeout now uses Session.DFT_TIMEOUT when timeout=0
> >
> > 2. Fixed stupid indent error in do_cleanup method.
> >
> > 3. Added comments to do_cleanup method to highlight possible
> > file/session locking issues.
> >
> > 4. Removed some log_error calls that slipped in from my  debugging version.
> >
> > Patch is attached. Is there any sort of convention for patch file naming?
> >
> > Jim
> 
> Hi Jim,
> 
> OK, I've integrated your fixes.
> 
> Regarding the do_cleanup locking issue, I had two ideas in mind :
> 
> 1) Hold the lock n° 0 (AKA the "dbm lock") while doing the cleanup to
> prevent two concurrent cleanups in the case we are very unlucky (two
> cleanups triggered at the same time). More than that, we should try to
> hold the lock with an APR try_lock call (which I think is not
> implemented yet in _apache.c), so that if the lock is currently held,
> we know that a cleanup is already being performed, so we can safely
> skip it.
> 
> 2) while the cleanup is being performed, hold the lock on each session
> with a try_lock call, so that if a session is locked, it will never be
> candidate for a cleanup.
> 
> Regards,
> Nicolas

I have checked in an implementation of _apache._global_trylock, which
is a shameless copy/paste of _global_lock with some adaptation to use
apr_global_mutex_trylock. Unfortunately my tests seem to show that the
implementation is not good in that it erroneously tells me that the
lock is acquired even when it isn't... Must work on it a little more.
But for now, I'm off to real work !

Regards,
Nicolas

Mime
View raw message