• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Cannot Reproduce
  • ehcache
  • hsingh
  • Reporter: juanux
  • October 06, 2009
  • 0
  • Watchers: 0
  • January 17, 2013
  • December 01, 2009

Description

We implement ehcache as a fundamental part of our system, because we manage some database tables with over 20,000 records.

Unfortunately, despite this, on many occasions ehcache failure and can be viewed on the console a lot of hibernate queries on the tables that are supposedly cached.

We’ve done several tests to determine the exact cause of this problem, but behaves a random.

our ehcache.cfg.xml is something like it

<defaultCache 
     maxElementsInMemory="100" 
			 eternal="false"
	     timeToIdleSeconds="120" 
	     timeToLiveSeconds="120" 
	     overflowToDisk="false" />

<cache name="mint.hibernate.bean.Employee"
     maxElementsInMemory="30000"
     eternal="true"
     overflowToDisk="false"
     >

The ehcache failt exactly when executes the folliwing code:

if(objectType == EResourceType.EMPLOYEE){
	
  object = getSession().get(DBEmployee.class, objectKey.longValue()); 

  if(employeeResourceLocationMap.containsKey(((DBEmployee)object).getKey())){
	
	  locationKey = employeeResourceLocationMap.get(((DBEmployee)object).getKey());
  }else{
	  locationKey    =  ((DBEmployee)object).getLocationTree().getLocationKey();
  }

  if(object != null){

	   if(locationTimeZoneMap.containsKey(locationKey)){
		  timeZone = locationTimeZoneMap.get(locationKey);
	}

else{

        timeZoneObject =  ((DBLocation)getSession().get(DBLocation.class, locationKey)).getTimezone();
        timeZone = timeZoneObject;
        if(timeZoneObject != null)\{
            resourcesTimeZoneMap.put(objectKey,timeZoneObject);
       	 \}
        locationTimeZoneMap.put(locationKey, timeZone);
    
	}
 }
  
}

thank you very much beforehand

Comments

gluck 2009-10-09

I think this is fixed in 1.7 and was related to the algorithmic regression where PUTs were not counting as recently used.

Juan Jose Morales Arias 2009-10-14

Hi, We identify that the problem is present when the cache is used in a concurrent context.

for example when we run our app and load the data and later whe run a test case with the following code:

while(true){

for(Long key : employeeKeys){ session.get(DBEmployee.class,key); }

}

there is the hibernate queries in the console.

we ‘re using the following conf

we appreciate your help. thaks

Abhishek Singh 2009-11-16

Hi Jose,

Can you trim down your app or write a small app that can reproduce this problem easily? That would be really helpful in finding out what exactly is the problem.

Looking at the code snippets, nothing seems to be pointing towards any problem. A small app that can repro this problem will give much more insight.

Alex Miller 2009-12-01

Marking as not reproducible right now. Please retry with latest Ehcache (1.7.x) release and/or provide a reproducible use case.