jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Cronin" <Tim.Cro...@autonomy.com>
Subject RE: index cache corruption
Date Tue, 11 Aug 2009 19:31:59 GMT
The key is a string so java would be unusable :D.
We also don't see this for every cache it. 
I have not seen it fail doing local testing.

We've seen it with a couple of customers currently.
This is why we're trying the block cache.

We dump the key's and we can see that they don't match

It seems to happen more often when invalidation of the cache is taking place.
That is removing cache items that are linked with the subkey: mechanism.

We ended up putting in some read|write locks on the cache wrapper
And it seems to minimize the issue but not eliminate it. We also purge
The cache files at startup.

-----Original Message-----
From: Aaron Smuts [mailto:asmuts@yahoo.com] 
Sent: Tuesday, August 11, 2009 2:22 PM
To: JCS Users List
Subject: Re: index cache corruption


I've never seen anything of the sort!  The indexed disk cache would be unusable if it had
this problem.  And I use it extensively.

I suspect that you have a bad equals method on your objects.

Are you still seeing this?  

Aaron

--- On Tue, 8/11/09, Tim Cronin <Tim.Cronin@autonomy.com> wrote:

> From: Tim Cronin <Tim.Cronin@autonomy.com>
> Subject: index cache corruption
> To: "JCS Users List" <jcs-users@jakarta.apache.org>
> Date: Tuesday, August 11, 2009, 11:35 AM
> We initially were using indexed disk
> cache but ran into cache corruption
> where the data returned for a key would not be the data
> associated for
> that key. I haven't been able to come up with a good repro
> scenario...
> 
> We had to work around it with the following code:
> 
>   /**
>    * is the cache element not the correct
> object for the key
>    * @param key the current key
>    * @param element the current element
> associated with the key
>    * @param hasReadLock whether caller has
> read lock
>    * @return true if key mismatch els false
>    * @throws InterruptedException if locking
> fails
>    */
>   private boolean isCorrupt(String key, ICacheElement
> element, boolean
> hasReadLock) throws InterruptedException
>   {
>     boolean corrupt =
> !key.equals(element.getKey());
>     if (corrupt)
>     {
>       mLogger.error("cache corruption!!! ["
> + (mCorruptionCounter++) +
> "]");
> 
>       if (mLogger.isDebugEnabled())
>       {
>        mLogger.error("culprit
> stack...", new Exception("cache
> corruption"));
>       }
> 
>       try
>       {
>         if (hasReadLock)
>         {
>          
> mLock.readLock().release();
>         }
>         mLock.writeLock().acquire();
>         try
>         {
>           mLogger.error("purging "
> + key);
>           mCache.remove(key);
>           mCache.remove(key +
> ":");
>         }
>         catch (Exception e)
>         {
>           mLogger.error("failed to
> purge key " + key, e);
>         }
>         try
>         {
>           String k =
> (String)element.getKey();
>           mLogger.error("purging "
> + k);
>           mCache.remove(k);
>           mCache.remove(k + ":");
>         }
>         catch (Exception e)
>         {
>           mLogger.error("failed to
> purge key " + element.getKey(), e);
>         }
>       }
>       finally
>       {
>         if (hasReadLock)
>         {
>          
> mLock.readLock().acquire();
>         }
>         mLock.writeLock().release();
>       }
>     }
>     return corrupt;
>   }
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Mime
View raw message