dbm CacheManager crashes if tmp disappears
Opened this issue · 3 comments
aiguofer commented
I have an app running on an OpenStack image and it recently started misbehaving. When I looked into it, I found this in the logs:
File "./segmentation/customer_data.py", line 9, in __init__
self.weights = get_product_line_prices(weights)
File "/usr/lib/python2.7/site-packages/beaker/cache.py", line 595, in cached
return cache[0].get_value(cache_key, createfunc=go)
File "/usr/lib/python2.7/site-packages/beaker/cache.py", line 318, in get
return self._get_value(key, **kw).get_value()
File "/usr/lib/python2.7/site-packages/beaker/container.py", line 330, in get_value
self.namespace.acquire_read_lock()
File "/usr/lib/python2.7/site-packages/beaker/container.py", line 204, in acquire_read_lock
self.access_lock.acquire_read_lock()
File "/usr/lib/python2.7/site-packages/beaker/synchronization.py", line 154, in acquire_read_lock
x = self.do_acquire_read_lock(wait)
File "/usr/lib/python2.7/site-packages/beaker/synchronization.py", line 241, in do_acquire_read_lock
filedescriptor = self._open(os.O_CREAT | os.O_RDONLY)
File "/usr/lib/python2.7/site-packages/beaker/synchronization.py", line 236, in _open
filedescriptor = os.open(self.filename, mode)
OSError: [Errno 2] No such file or directory: '/tmp/cache/lock/1/13/13c02d91731613ece4c33248c0afe6a63a60b5d3.lock'
Here, get_product_line_prices
is cached with @cache.cache('meh', expire=60*60*24*7)
and the CacheManager is instanciated with:
cache_opts = {
'cache.type': 'dbm',
'cache.data_dir': '/tmp/cache/data',
'cache.lock_dir': '/tmp/cache/lock'
}
cache = CacheManager(**parse_cache_config_options(cache_opts))
It seems that somehow my tmp
dir was cleared; Should this be handled by the FileSynchronizer
?
tanmainaik commented
Any updates on this issue. Am facing the same issue.
amol- commented
I'll try to address this during the weekend, if you want to submit a pull request with a fix to speed up the release process I can review it earlier.