>
> The source of the problem is in the gluon/cache.py
>
When I have revert this only file to the version of 2012-09-18 - cache.disk 
is working again

below the method from that file, which have became errorous in the last 
versions:

def _open_shelf_with_lock(self):
        """Open and return a shelf object, obtaining an exclusive lock
        on self.locker first. Replaces the close method of the
        returned shelf instance with one that releases the lock upon
        closing."""
        def _close(self):
            try:
                shelve.Shelf.close(self)
            finally:
                portalocker.unlock(self.locker)
                self.locker.close()

        storage, locker, locker_locked = None, None, False
        try:
            locker = open(self.locker_name, 'a')
            portalocker.lock(locker, portalocker.LOCK_EX)
            locker_locked = True
            storage = shelve.open(self.shelve_name)
            storage.close = _close.__get__(storage, shelve.Shelf)
            storage.locker = locker
        except Exception:
            logger.error('corrupted cache file %s, will try to delete and 
recreate it!' % (self.shelve_name))
            if storage:
                storage.close()
                storage = None

            try:
                os.unlink(self.shelve_name)
                storage = shelve.open(self.shelve_name)
                storage.close = _close.__get__(storage, shelve.Shelf)
                storage.locker = locker
                if not CacheAbstract.cache_stats_name in storage.keys():
                    storage[CacheAbstract.cache_stats_name] = {
                        'hit_total': 0,
                        'misses': 0,
                    }
                storage.sync()
            except (IOError, OSError):
                logger.warn('unable to delete and recreate cache file %s' % 
self.shelve_name)
                if storage:
                        storage.close()
                        storage = None
                if locker_locked:
                    portalocker.unlock(locker)
                if locker:
                    locker.close()
        return storage


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to