[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
ehcache evicts items locked by Hibernate!  XML
Forum Index -> Ehcache
Author Message
bgranvea

neo

Joined: 09/25/2009 06:43:29
Messages: 3
Offline

Hi,

I'm using EHCache 1.6.2 + Hibernate 3.3.2. I've noticed many messages "org.hibernate.cache.ReadWriteCache - An item was expired by the cache while it was locked" in my logs.

After adding some logs into EHCache source, I've discovered that Hibernate's message corresponds to items evicted by EHCache when the cache is full.

Is this a normal behavior? why are these items evicted by the (default) LRU algorithm, although there seem to have been accessed (and locked) by Hibernate just before??

I'm not sure of the consequences on Hibernate side when this happens, but Hibernate's message is very annoying because it has a warning log level.

Thanks.
bgranvea

neo

Joined: 09/25/2009 06:43:29
Messages: 3
Offline

Just a wild guess: I see that cache elements have a lastAccessTime=0 when they are created (at least in Hibernate case), and thus can be selected by LruPolicy for eviction.

Shouldn't lastAccessTime be initialized with System.currentTimeMillis() at element creation?

Thanks.
bgranvea

neo

Joined: 09/25/2009 06:43:29
Messages: 3
Offline

I've filled a bug and submitted a patch. See https://jira.terracotta.org/jira/browse/EHC-396
gluck

master

Joined: 09/15/2009 18:01:23
Messages: 75
Location: Brisbane, Australia
Offline

An exact fix requires using a deterministic evictor.

See http://ehcache.org/documentation/hibernate.html#FAQ where this issue is discussed in detail.
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team