Hi Ben,

I've recently upgraded one of my busiest sites to use beaker 1.4.2 and
I am getting an intermittent error:

Module beaker.cache:115 in get
<<      def get(self, key, **kw):
               """Retrieve a cached value from the container"""
               return self._get_value(key, **kw).get_value()
           get_value = get

>>  return self._get_value(key, **kw).get_value()
Module beaker.container:269 in get_value
<<              if not creation_lock.acquire(wait=False):
                       debug("get_value returning old value while new
one is created")
                       return value
                   else:
                       debug("lock_creatfunc (didnt wait)")
>>  return value
UnboundLocalError: local variable 'value' referenced before assignment

I am using Memcached with the pure-python driver as the caching
backend.  What we do is manually invalidate (delete) the cache under
certain circumstances.  What is happening here as far as I can tell
is:
 - the cache gets delted (using memcached's delete key functionality)
 - the first request comes in where it gets regenerated
 - while the cache is being regenerated,  a second request comes in
and beaker tries to return the old value which no longer exists, even
though for some reason beaker thinks its there.

I understand this is to avoid the dog-pile effect, and would be the
correct thing to do if we still had the old cache.

Is delting the key not the way to go?  Can I 'invlidate' the cache
some other way that preserves the anti-dogpile effect?

Also, should beaker not behave differently if there is no old value to
return?

Thanks,
Damian

> This bug has been fixed with a work-around in Beaker, and Beaker 1.4.2  
> has been released with it.
>
> - Ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to