diff -r 5494361ffa11 MoinMoin/auth/__init__.py
--- a/MoinMoin/auth/__init__.py	Sun Feb 03 14:41:59 2008 +0100
+++ b/MoinMoin/auth/__init__.py	Sun Feb 03 17:02:41 2008 +0100
@@ -93,7 +93,8 @@ class UserSecurityStringCache:
         """
         secrets, lru = self._load()
         # just move this secret to the front of the LRU queue
-        lru.remove(secidx)
+        if secidx in lru:        # BUG CachingLockFail
+            lru.remove(secidx)
         lru.insert(0, secidx)
         self.ce.update((secrets, lru))
 
diff -r 5494361ffa11 MoinMoin/caching.py
--- a/MoinMoin/caching.py	Sun Feb 03 14:41:59 2008 +0100
+++ b/MoinMoin/caching.py	Sun Feb 03 17:02:41 2008 +0100
@@ -129,7 +129,7 @@ class CacheEntry:
                 content = pickle.dumps(content, PICKLE_PROTOCOL)
             elif self.use_encode:
                 content = content.encode(config.charset)
-            if not self.locking or self.locking and self.wlock.acquire(1.0):
+            if not self.locking or self.locking and self.wlock.acquire(10.0): # BUG CachingLockFail
                 try:
                     # we do not write content to old inode, but to a new file
                     # so we don't need to lock when we just want to read the file
@@ -162,8 +162,9 @@ class CacheEntry:
             self.request.log("Can't acquire write lock in %s" % self.lock_dir)
 
     def content(self):
+        data = ""   # BUG CachingLockFail
         try:
-            if not self.locking or self.locking and self.rlock.acquire(1.0):
+            if not self.locking or self.locking and self.rlock.acquire(10.0): # BUG CachingLockFail
                 try:
                     f = open(self._filename(), 'rb')
                     data = f.read()
diff -r 5494361ffa11 MoinMoin/util/lock.py
--- a/MoinMoin/util/lock.py	Sun Feb 03 14:41:59 2008 +0100
+++ b/MoinMoin/util/lock.py	Sun Feb 03 17:02:41 2008 +0100
@@ -110,7 +110,7 @@ class ExclusiveLock:
                 # log('acquired exclusive lock: %s\n' % (self.lockDir, ))
                 return True
             except OSError, err:
-                if err.errno != errno.EEXIST:
+                if err.errno not in [errno.EEXIST,errno.EACCES]: # BUG CachingLockFail
                     raise
                 if self.expire():
                     continue # Try immediately to acquire
@@ -170,12 +170,20 @@ class ExclusiveLock:
 
     def _removeLockDir(self):
         """ Remove lockDir ignoring 'No such file or directory' errors """
-        try:
-            os.rmdir(self.lockDir)
-        except OSError, err:
-            if err.errno != errno.ENOENT:
+        timer = self.timerClass(1)      # BUG CachingLockFail
+        timer.start()
+	removed = False  # else undefined error
+        while timer.haveTime():
+            try:
+                os.rmdir(self.lockDir)
+                removed = True
+                break
+            except OSError, err:
+                # log( "_removeLockDir delayed\n" )
+                timer.sleep()
+        if not removed:
+            if err.errno != errno.EEXIST:
                 raise
-
 
 class WriteLock(ExclusiveLock):
     """ Exclusive Read/Write Lock
