Attachment 'Caching_lock_diff_from_zip_file.patch'
Download 1 diff -r 5494361ffa11 MoinMoin/auth/__init__.py
2 --- a/MoinMoin/auth/__init__.py Sun Feb 03 14:41:59 2008 +0100
3 +++ b/MoinMoin/auth/__init__.py Sun Feb 03 17:02:41 2008 +0100
4 @@ -93,7 +93,8 @@ class UserSecurityStringCache:
5 """
6 secrets, lru = self._load()
7 # just move this secret to the front of the LRU queue
8 - lru.remove(secidx)
9 + if secidx in lru: # BUG CachingLockFail
10 + lru.remove(secidx)
11 lru.insert(0, secidx)
12 self.ce.update((secrets, lru))
13
14 diff -r 5494361ffa11 MoinMoin/caching.py
15 --- a/MoinMoin/caching.py Sun Feb 03 14:41:59 2008 +0100
16 +++ b/MoinMoin/caching.py Sun Feb 03 17:02:41 2008 +0100
17 @@ -129,7 +129,7 @@ class CacheEntry:
18 content = pickle.dumps(content, PICKLE_PROTOCOL)
19 elif self.use_encode:
20 content = content.encode(config.charset)
21 - if not self.locking or self.locking and self.wlock.acquire(1.0):
22 + if not self.locking or self.locking and self.wlock.acquire(10.0): # BUG CachingLockFail
23 try:
24 # we do not write content to old inode, but to a new file
25 # so we don't need to lock when we just want to read the file
26 @@ -162,8 +162,9 @@ class CacheEntry:
27 self.request.log("Can't acquire write lock in %s" % self.lock_dir)
28
29 def content(self):
30 + data = "" # BUG CachingLockFail
31 try:
32 - if not self.locking or self.locking and self.rlock.acquire(1.0):
33 + if not self.locking or self.locking and self.rlock.acquire(10.0): # BUG CachingLockFail
34 try:
35 f = open(self._filename(), 'rb')
36 data = f.read()
37 diff -r 5494361ffa11 MoinMoin/util/lock.py
38 --- a/MoinMoin/util/lock.py Sun Feb 03 14:41:59 2008 +0100
39 +++ b/MoinMoin/util/lock.py Sun Feb 03 17:02:41 2008 +0100
40 @@ -110,7 +110,7 @@ class ExclusiveLock:
41 # log('acquired exclusive lock: %s\n' % (self.lockDir, ))
42 return True
43 except OSError, err:
44 - if err.errno != errno.EEXIST:
45 + if err.errno not in [errno.EEXIST,errno.EACCES]: # BUG CachingLockFail
46 raise
47 if self.expire():
48 continue # Try immediately to acquire
49 @@ -170,12 +170,20 @@ class ExclusiveLock:
50
51 def _removeLockDir(self):
52 """ Remove lockDir ignoring 'No such file or directory' errors """
53 - try:
54 - os.rmdir(self.lockDir)
55 - except OSError, err:
56 - if err.errno != errno.ENOENT:
57 + timer = self.timerClass(1) # BUG CachingLockFail
58 + timer.start()
59 + removed = False # else undefined error
60 + while timer.haveTime():
61 + try:
62 + os.rmdir(self.lockDir)
63 + removed = True
64 + break
65 + except OSError, err:
66 + # log( "_removeLockDir delayed\n" )
67 + timer.sleep()
68 + if not removed:
69 + if err.errno != errno.EEXIST:
70 raise
71 -
72
73 class WriteLock(ExclusiveLock):
74 """ Exclusive Read/Write Lock
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.