-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: What to do? "Cache item was locked"
PostPosted: Wed Dec 03, 2003 10:47 pm 
Newbie

Joined: Tue Nov 25, 2003 5:05 pm
Posts: 18
Environment: Hibernate 2.1RC1 + Spring 1.0 M4 + Ehcache
I want to use the read-write cache functionality but everytime the session looks up an object it has to be reread from the DB.
The class has an <cache usage="read-write"/> element and I've specified dynamic-update="false" and dynamic-insert="false".
The Session is the only current active session and there is no other transaction running at the moment.
Normally the last transaction should've unlocked every newloaded/modified cache item on commit but apparently this is not done.
So any ideas?

TIA
Sven


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 2:52 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Are you sure that afterTransactionCompletion() gets called?


Top
 Profile  
 
 Post subject: Bug in Hibernate or EHCache
PostPosted: Thu Dec 04, 2003 10:13 am 
Newbie

Joined: Tue Nov 25, 2003 5:05 pm
Posts: 18
After some debugging I figured out that there is a bug in Hibernate or EHCache (depends who violated the contract):

Code:
 
  //ReadWriteCache.java
  public boolean isGettable(long txTimestamp) {
   return freshTimestamp < txTimestamp;
  }

isGettable always returned false because freshTimestamp was _always_ significant bigger than txTimestamp (e.g.
4384950622642176 vs.
1070544590106)
This happens because net.sf.ehcache.hibernate.Plugin.nextTimestamp uses Timestamper.next() but net.sf.ehcache.hibernate.Provider.nextTimestamp uses System.currentTimeMillis.

q.e.d.

Sven


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 11:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I will fix ehcache


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 6:10 pm 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
Can someone give an update on this?

I have Hibernate 2.1 final jar and the 0.6 release of ehcache and I'm still getting ttl exceeded:

2003-12-11 17:03:32,748 [Thread-10] DEBUG net.sf.ehcache.Cache - timeToLiveSeconds exceeded : 44702

even when ttl is set to 21600 (6 hours) and a make the requests within seconds of each other.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 6:41 pm 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
never mind, I didn't realize that the ehcache defaultCache doesn't provide a template for the subsequent <cache> elements. So I hadn't specified the ttl for each of my regions and I guess it defaults to 0s.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.