2.4.7 problems

284 views
Skip to first unread message

BlueShadow

unread,
May 28, 2013, 5:58:35 AM5/28/13
to web...@googlegroups.com
Hi,
I updated to the newest version of web2py and I got at least to problems:
there is no client cache funktion anymore.
the second one:
I get an error when I create a cached version of a page:
@auth.requires_membership('VIP')
@cache("Ertrag", time_expire=86400, cache_model=cache.disk)
def Ertrag():
   
Liste=getvaluesfromDB(db)
   
Liste=Sortvalues(Liste)
   
return response.render(Liste=Liste)

returns this error

<type 'exceptions.RuntimeError'> unable to create/re-create cache file F:\Website\web2py\applications\Prolog\cache\cache.shelve

Version

web2py™ Version 2.4.7-stable+timestamp.2013.05.24.17.48.47
Python Python 2.7.4: C:\Python27\python.exe (prefix: C:\Python27)

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
Traceback (most recent call last):
File "F:\Website\web2py\gluon\restricted.py", line 212, in restricted
exec ccode in environment
File "F:/Website/web2py/applications/Prolog/controllers/default.py", line 188, in <module>
File "F:\Website\web2py\gluon\globals.py", line 194, in <lambda>
self._caller = lambda f: f()
File "F:\Website\web2py\gluon\tools.py", line 3021, in f
return action(*a, **b)
File "F:\Website\web2py\gluon\cache.py", line 402, in __call__
self.time_expire)
File "F:\Website\web2py\gluon\cache.py", line 347, in __call__
storage = self._open_shelve_and_lock()
File "F:\Website\web2py\gluon\cache.py", line 299, in _open_shelve_and_lock
'unable to create/re-create cache file %s' % self.shelve_name)
RuntimeError: unable to create/re-create cache file F:\Website\web2py\applications\Prolog\cache\cache.shelve

Error snapshot help

<type 'exceptions.RuntimeError'>(unable to create/re-create cache file F:\Website\web2py\applications\Prolog\cache\cache.shelve)

inspect attributes

Atribute der Ausnahmeinstanz

args (r'unable to create/re-create cache file F:\Website\web2py\applications\Prolog\cache\cache.shelve',)
__setattr__ <method-wrapper '__setattr__' of exceptions.RuntimeError object>
__reduce_ex__ <built-in method __reduce_ex__ of exceptions.RuntimeError object>
__getslice__ <method-wrapper '__getslice__' of exceptions.RuntimeError object>
__getitem__ <method-wrapper '__getitem__' of exceptions.RuntimeError object>
__setstate__ <built-in method __setstate__ of exceptions.RuntimeError object>
__getattribute__ <method-wrapper '__getattribute__' of exceptions.RuntimeError object>
__str__ <method-wrapper '__str__' of exceptions.RuntimeError object>
__format__ <built-in method __format__ of exceptions.RuntimeError object>
__reduce__ <built-in method __reduce__ of exceptions.RuntimeError object>
__class__ <type 'exceptions.RuntimeError'>
__dict__ {}
__delattr__ <method-wrapper '__delattr__' of exceptions.RuntimeError object>
__subclasshook__ <built-in method __subclasshook__ of type object>
__repr__ <method-wrapper '__repr__' of exceptions.RuntimeError object>
__init__ <method-wrapper '__init__' of exceptions.RuntimeError object>
__hash__ <method-wrapper '__hash__' of exceptions.RuntimeError object>
__sizeof__ <built-in method __sizeof__ of exceptions.RuntimeError object>
__doc__ 'Unspecified run-time error.'
__unicode__ <built-in method __unicode__ of exceptions.RuntimeError object>
__new__ <built-in method __new__ of type object>

...default.py
    http://..../[app]/default/data/update/[table]/[id]
http://..../[app]/default/data/delete/[table]/[id]
http://..../[app]/default/data/select/[table]
http://..../[app]/default/data/search/[table]
but URLs must be signed, i.e. linked with
A('table',_href=URL('data/tables',user_signature=True))
or with the signed load operator
LOAD('default','data.load',args='tables',ajax=True,user_signature=True)
"""
return dict(form=crud(),nsb=1)

Niphlod

unread,
May 28, 2013, 6:32:18 AM5/28/13
to web...@googlegroups.com
cache.client was experimental. it was renamed to cache.action

As for the second error, try to delete the cache/ directory

BlueShadow

unread,
May 28, 2013, 8:21:18 AM5/28/13
to web...@googlegroups.com
deleting the cache directory has no effekt.
any other ideas?

BlueShadow

unread,
May 28, 2013, 3:56:54 PM5/28/13
to web...@googlegroups.com


I just changet it from cache.disk to cache.ram and it works but I would prefer to put it on the disk and not to the ram.







































Niphlod

unread,
May 28, 2013, 4:03:15 PM5/28/13
to web...@googlegroups.com
I tried with cache.disk and no error occurred.
Are you positive that there are no permission issues on the cache folder ?

BlueShadow

unread,
May 29, 2013, 6:28:35 AM5/29/13
to web...@googlegroups.com
I just rechecked it the standard www-data user is the owner of the folder and its content.

Marian

unread,
May 30, 2013, 3:46:27 AM5/30/13
to
I can confirm the exception, on my local developement system the created cache.shelve has no owner and so it is not readable/writeable by the current sys user. When I create an empty cache.shelve by myself it seems to work.

LightDot

unread,
May 30, 2013, 6:41:12 AM5/30/13
to web...@googlegroups.com
If it's a linux system, it must have an owner. Perhaps it's just called "nobody", or is it a nonexisting user, or...?

Could you please describe how do you start web2py, under which user accounts, etc. etc.

Regards,
Ales


On Thursday, May 30, 2013 9:43:28 AM UTC+2, Marian wrote:
I can confirm the exception, on my local developement system the created cache.shelve has no owner and so it is not readable/writeable by the current sys user. When I create an empty cache.shelve by myself it seems to work.
 
On Wednesday, May 29, 2013 12:28:35 PM UTC+2, BlueShadow wrote:

Kevin Bethke

unread,
May 30, 2013, 6:50:03 AM5/30/13
to web...@googlegroups.com
I used the standard web2py-ubuntu-nginx install so www-user should be the right one. but I got that user and full access to the cache folder for everyone. drwxrwxrwx


--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/1MlmDm8II3k/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Niphlod

unread,
May 30, 2013, 7:06:23 AM5/30/13
to web...@googlegroups.com
ehm ? I thought the problem was on windows ! :D

Marian

unread,
May 30, 2013, 7:10:47 AM5/30/13
to
My local development system is windows 7 with the build in rocket server, my test server is a IIS 7 running with isapi_wsgi.

On both, the cache.shelve created by web2py has no owner.

Kevin Bethke

unread,
May 30, 2013, 7:17:33 AM5/30/13
to web...@googlegroups.com
for me its on both local development(windows) and server(ubuntu)


On Thu, May 30, 2013 at 1:10 PM, Marian <scor...@gmx.net> wrote:
My local development system is windows 7 width the build in rocket server, my test server is a IIS 7 running with isapi_wsgi.


On both, the cache.shelve created by web2py has no owner.



On Thursday, May 30, 2013 12:41:12 PM UTC+2, LightDot wrote:
--

sherdim

unread,
Oct 7, 2013, 7:21:55 AM10/7/13
to web...@googlegroups.com
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


Massimo Di Pierro

unread,
Oct 7, 2013, 9:30:47 AM10/7/13
to web...@googlegroups.com
Please open a ticket about this.

Mark Li

unread,
Oct 20, 2013, 8:11:32 PM10/20/13
to web...@googlegroups.com
I've just encountered this problem myself, and I opened a ticket about this since I couldn't find one already posted.

http://code.google.com/p/web2py/issues/detail?id=1736&thanks=1736&ts=1382314136

Arglanir

unread,
Oct 31, 2013, 9:13:16 AM10/31/13
to web...@googlegroups.com
Hello everyone,
I encountered this problem on 2.2.1 myself, so I checked the trunk source code and it has not moved a lot since.
I investigated this problem and found the bug, and thus the correction:
You can now correct if for next version :-)
You're welcome.
Reply all
Reply to author
Forward
0 new messages