-->
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.  [ 12 posts ] 
Author Message
 Post subject: JBoss Cache Commit with UseQueryCache=true Issue
PostPosted: Mon Oct 18, 2004 11:56 am 
Newbie

Joined: Fri Sep 10, 2004 9:46 am
Posts: 10
I have a problem with using Hibernate and have isolated it to the setting QueryCacheEnabled=true. With this set to false the bug is not present and the application works flawlessly. When QueryCacheEnabled is set to true the error occurs. Below is a description of how things work. The error, and my suspicions follow at the end.

I have spent some considerable time looking into this issue, and believe I have narrowed it down substantially

Hibernate version: 2.1.6
JBoss version: 4.0.0

In summary: Hibernate runs within JBoss application server as a registered MBean. It uses JBossTree cache as its cache provider, which is also registereas an MBean. See below.

Code:
<mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate">

<depends>jboss:service=TransactionManager</depends>
<depends>jboss.jca:service=DataSourceBinding,name=b3xt_ds_pirate</depends>
<depends>jboss.cache:service=TreeCache</depends>
<attribute name="DatasourceName">java:/b3xt_ds_pirate</attribute>
<attribute name="SessionFactoryName">java:/hibernate/HibernateFactory</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.SQLServerDialect</attribute>
<attribute name="CacheProviderClass">MyJBossTreeCacheProvider</attribute>
<attribute name="SessionFactoryInterceptor">caw.b3xt.domain.Interceptor</attribute>
<attribute name="HarUrl">${jboss.server.home.dir}/lib/pirate_hib.jar</attribute>
<attribute name="QuerySubstitutions">true 1, false 0, yes 'Y', no 'N'</attribute>
<attribute name="QueryCacheEnabled">false</attribute>

<mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=TreeCache">

<depends>jboss:service=Naming</depends>
<depends>jboss:service=TransactionManager</depends>
<attribute name="JndiName">java:/TreeCache</attribute>
<attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
<attribute name="IsolationLevel">READ_COMMITTED</attribute>
<attribute name="CacheMode">REPL_ASYNC</attribute>
<attribute name="UseReplQueue">false</attribute>
<attribute name="ReplQueueInterval">1000</attribute>
<attribute name="ReplQueueMaxElements">20</attribute>
<attribute name="FetchStateOnStartup">true</attribute>
<attribute name="InitialStateRetrievalTimeout">15000</attribute>
<attribute name="SyncReplTimeout">10000</attribute>
<attribute name="LockAcquisitionTimeout">15000</attribute>
<attribute name="EvictionPolicyClass"></attribute>
<attribute name="ClusterName">TreeCache-Cluster</attribute>
<attribute name="ClusterConfig">
<config>
<UDP mcast_addr="228.1.2.3" mcast_port="12233" ip_ttl="64" ip_mcast="true" mcast_send_buf_size="150000" cast_recv_buf_size="80000"
ucast_send_buf_size="150000" ucast_recv_buf_size="80000" bind_addr="primary.nic.b3xt.host" loopback="true"/>
<PING timeout="2000" num_initial_members="3" />
<MERGE2 min_interval="10000" max_interval="20000"/>
<FD_SOCK/>
<VERIFY_SUSPECT timeout="1500" up_thread="false" down_thread="false"/>
<pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800" max_xmit_size="8192" up_thread="false" down_thread="false"/>
<UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10" down_thread="false"/>
<pbcast.STABLE desired_avg_gossip="20000" up_thread="false" down_thread="false"/>
<FRAG frag_size="8192" down_thread="false" up_thread="false"/>
<pbcast.GMS join_timeout="5000" join_retry_timeout="2000" shun="true" print_local_addr="true"/>
<pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
</config>
</attribute>


The "MyJBossTreeCacheProvider" hibernate cache provider class is a copy of the Hibernate supplied "net.sf.hibernate.cacheTreeCacheProvider", but looks up the Cache in JNDI, rather than constructing the Cache on the fly. This allows the cache to be configured and managed as a regular MBean.

All hibernate access is done within Stateless session EJB's. This bean method has been declared with a Transaction Attribute of "Required", meaning a JTA transaction is created, and managed by the container. The above MBean configuration ensures that the Cache and Hibernate act within the semantics of JTA transactions.

I have ensured all hibernate mapping documents have set cache usage as either "transactional" or as "read-only"

The EJB's obtains a hibernate session by using the JBoss 4.0.0 (final release) org.jboss.hibernate.session.HibernateContext.getSession( String name ); method. And do not flush, commit, or otherwise close the session, leaving this up to JTA.

The EJB's are invoked via a Structs action class, which calls the bean, performs a hibernate update, stores the result in the Session. A JSP then presents the information. This architecture should be fairly standard, and works perfectly.

QueryCacheEnabled=true

After setting QueryCacheEnabled=true, The bug occurs on the second request to a URL, wheras worked perfectly before. The error produced is as follows.

Code:
2004-10-18 14:29:34,734 ERROR [net.sf.hibernate.impl.SessionImpl] Could not synchronize database state with session
net.sf.hibernate.cache.CacheException: org.jboss.cache.lock.TimeoutException: lock could not be acquired after 15000 ms. Lock map ownership Read lock owners: []
Write lock owner: <primary:3279>:15
at caw.util.hibernate.cache.JBossTreeCache.put(JBossTreeCache.java:75)
at net.sf.hibernate.cache.UpdateTimestampsCache.preinvalidate(UpdateTimestampsCache.java:42)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2413)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2368)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
...


However I believe the error was caused by a previous URL request creating a lock in the cache which was never released. Remember the error occurs on the second invocation to the URL.

To diagnose the problem enabled DEBUG level logging in JBoss for Hibernate, and JBossCache. When the application is working (QueryCacheEnabled=false) the following is a dump of the DEBUG log.

Code:
2004-10-18 15:16:23,718 DEBUG [net.sf.hibernate.impl.SessionImpl] post flush
2004-10-18 15:16:23,718 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction before completion callback
2004-10-18 15:16:23,718 DEBUG [net.sf.hibernate.impl.SessionImpl] closing session
2004-10-18 15:16:23,718 DEBUG [net.sf.hibernate.impl.SessionImpl] disconnecting session
2004-10-18 15:16:23,718 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction after completion callback, status: 3
2004-10-18 15:16:23,718 DEBUG [net.sf.hibernate.impl.SessionImpl] transaction completion
2004-10-18 15:16:23,718 DEBUG [org.jboss.cache.interceptors.ReplicationInterceptor] runPreparePhase(): run remote prepare with async mode: true commit: true and coordinator: primary:3387
2004-10-18 15:16:23,718 DEBUG [org.jboss.cache.TreeCache] callRemoteMethods(): valid members are [smtpserver:4076]
2004-10-18 15:16:23,718 DEBUG [org.jboss.cache.TreeCache] commit(): called to commit cache with gtx <primary:3387>:15
2004-10-18 15:16:23,734 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock
2004-10-18 15:16:23,734 DEBUG [org.jboss.cache.lock.IdentityLock] release(): lock map owner <primary:3387>:15 not found. Could have been released.
2004-10-18 15:16:23,734 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock read owners=[<primary:3387>:15]
2004-10-18 15:16:23,734 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock write owner=<primary:3387>:15
2004-10-18 15:16:23,734 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock read owners=[<primary:3387>:15]
2004-10-18 15:16:23,734 DEBUG [org.jboss.cache.TreeCache] commit(): removing local transaction key TransactionImpl:XidImpl[FormatId=257, GlobalId=cw-scgymo62h4gl/27, BranchQual=, localId=27]
2004-10-18 15:16:23,750 DEBUG [JSP] JSP Start


The last line of the log is where my JSP takes over, notice that the last thing the cache does is to do a commit. When the application is Not working (QueryCacheEnabled=true) the following appears in the log.

Code:
2004-10-18 14:49:01,000 DEBUG [net.sf.hibernate.impl.SessionImpl] post flush
2004-10-18 14:49:01,000 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction before completion callback
2004-10-18 14:49:01,000 DEBUG [net.sf.hibernate.impl.SessionImpl] closing session
2004-10-18 14:49:01,000 DEBUG [net.sf.hibernate.impl.SessionImpl] disconnecting session
2004-10-18 14:49:01,000 DEBUG [org.jboss.cache.interceptors.ReplicationInterceptor] runPreparePhase(): run remote prepare with async mode: true commit: true and coordinator: primary:3342
2004-10-18 14:49:01,000 DEBUG [org.jboss.cache.TreeCache] callRemoteMethods(): valid members are [smtpserver:4076]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): called to commit cache with gtx <primary:3342>:16
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.lock.IdentityLock] release(): lock map owner <primary:3342>:16 not found. Could have been released.
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock read owners=[<primary:3342>:16]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock write owner=<primary:3342>:16
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock write owner=<primary:3342>:16
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock read owners=[<primary:3342>:16]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock write owner=<primary:3342>:16
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock read owners=[<primary:3342>:16]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): removing local transaction key TransactionImpl:XidImpl[FormatId=257, GlobalId=cw-scgymo62h4gl/26, BranchQual=, localId=26]
2004-10-18 14:49:01,015 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction after completion callback, status: 3
2004-10-18 14:49:01,015 DEBUG [net.sf.hibernate.impl.SessionImpl] transaction completion
[b]2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] _put(<primary:3342>:17, "//net/sf/hibernate/cache/UpdateTimestampsCache/UserList", item, 10981073410)
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.Node] acquired RL: fqn=//net/sf/hibernate/cache/UpdateTimestampsCache, owner=<primary:3342>:17, lock=read owners=[<primary:3342>:17]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.Node] acquired WL: fqn=//net/sf/hibernate/cache/UpdateTimestampsCache/UserList, owner=<primary:3342>:17, lock=write owner=<primary:3342>:17
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] _put(<primary:3342>:17, "//net/sf/hibernate/cache/UpdateTimestampsCache/GroupUser", item, 10981073410)
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.lock.IdentityLock] caller already owns lock.
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.Node] acquired RL: fqn=//net/sf/hibernate/cache/UpdateTimestampsCache, owner=<primary:3342>:17, lock=read owners=[<primary:3342>:17]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.Node] acquired WL: fqn=//net/sf/hibernate/cache/UpdateTimestampsCache/GroupUser, owner=<primary:3342>:17, lock=write owner=<primary:3342>:17[/b]
2004-10-18 14:49:01,031 DEBUG [JSP] JSP Start


Note the bolded section of the document, which is not present in the original log, this appears to be the QueryCache invalidation in the cache. However notice that there does not appear to be any commit logic at the end of the process. There fore I surmise, that locks are remaining open in the cache, and the next invocation of the URL, cannot obtain the locks it requires.

I have looked at the source code of hibernate, and believe the issue is in the area of the public void afterTransactionCompletion(boolean success) method in SessionImpl class. This method appears to be where query cache invalidation occurs, my guess based on the name of the method, it occurs after the JTA transaction has been committed, and as a consequence the JBossCache, which also uses JTA, has already done its commit. Therefore the locks generated from this call are never committed. This is also evidenced in the debug log above.

Shouldn


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 18, 2004 12:17 pm 
Newbie

Joined: Fri Sep 10, 2004 9:46 am
Posts: 10
Sorry about the bold not appearing in the log above.

Mark.

2004-10-18 14:49:01,000 DEBUG [net.sf.hibernate.impl.SessionImpl] post flush
2004-10-18 14:49:01,000 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction before completion callback
2004-10-18 14:49:01,000 DEBUG [net.sf.hibernate.impl.SessionImpl] closing session
2004-10-18 14:49:01,000 DEBUG [net.sf.hibernate.impl.SessionImpl] disconnecting session
2004-10-18 14:49:01,000 DEBUG [org.jboss.cache.interceptors.ReplicationInterceptor] runPreparePhase(): run remote prepare with async mode: true commit: true and coordinator: primary:3342
2004-10-18 14:49:01,000 DEBUG [org.jboss.cache.TreeCache] callRemoteMethods(): valid members are [smtpserver:4076]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): called to commit cache with gtx <primary:3342>:16
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.lock.IdentityLock] release(): lock map owner <primary:3342>:16 not found. Could have been released.
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock read owners=[<primary:3342>:16]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock write owner=<primary:3342>:16
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock write owner=<primary:3342>:16
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock read owners=[<primary:3342>:16]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock write owner=<primary:3342>:16
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): releasing lock read owners=[<primary:3342>:16]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] commit(): removing local transaction key TransactionImpl:XidImpl[FormatId=257, GlobalId=cw-scgymo62h4gl/26, BranchQual=, localId=26]
2004-10-18 14:49:01,015 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction after completion callback, status: 3
2004-10-18 14:49:01,015 DEBUG [net.sf.hibernate.impl.SessionImpl] transaction completion
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] _put(<primary:3342>:17, "//net/sf/hibernate/cache/UpdateTimestampsCache/UserList", item, 10981073410)
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.Node] acquired RL: fqn=//net/sf/hibernate/cache/UpdateTimestampsCache, owner=<primary:3342>:17, lock=read owners=[<primary:3342>:17]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.Node] acquired WL: fqn=//net/sf/hibernate/cache/UpdateTimestampsCache/UserList, owner=<primary:3342>:17, lock=write owner=<primary:3342>:17
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.TreeCache] _put(<primary:3342>:17, "//net/sf/hibernate/cache/UpdateTimestampsCache/GroupUser", item, 10981073410)
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.lock.IdentityLock] caller already owns lock.
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.Node] acquired RL: fqn=//net/sf/hibernate/cache/UpdateTimestampsCache, owner=<primary:3342>:17, lock=read owners=[<primary:3342>:17]
2004-10-18 14:49:01,015 DEBUG [org.jboss.cache.Node] acquired WL: fqn=//net/sf/hibernate/cache/UpdateTimestampsCache/GroupUser, owner=<primary:3342>:17, lock=write owner=<primary:3342>:17

2004-10-18 14:49:01,031 DEBUG [JSP] JSP Start


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 21, 2004 8:06 pm 
Regular
Regular

Joined: Thu Aug 26, 2004 9:23 pm
Posts: 71
Have you recieved any help with this issue? I appear to be experiencing a similar problem with hibernate attempting to place items in TreeCache after the transaction has been committed. I get the exception:

java.lang.IllegalStateException: Already committed.
at org.jboss.tm.TransactionImpl.registerSynchronization(TransactionImpl.java:702)
at org.jboss.cache.TreeCache.getCurrentTransaction(TreeCache.java:2592)
at org.jboss.cache.TreeCache.put(TreeCache.java:1329)
at net.sf.hibernate.cache.TreeCache.put(TreeCache.java:67)
at net.sf.hibernate.cache.UpdateTimestampsCache.invalidate(UpdateTimestampsCache.java:52)
at net.sf.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:605)
at net.sf.hibernate.engine.CacheSynchronization.afterCompletion(CacheSynchronization.java:29)
at org.jboss.tm.TransactionImpl.doAfterCompletion(TransactionImpl.java:1398)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:421)
at org.jboss.tm.TxManager.commit(TxManager.java:142)
at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:126)

This appears to leave TreeCache in an unknown lock state because when I attempt to execute the operation again I get a lock exception.

Any ideas? This problem is killing me. :)

Mike


Top
 Profile  
 
 Post subject: Try this
PostPosted: Fri Oct 22, 2004 3:28 am 
Newbie

Joined: Fri Sep 10, 2004 9:46 am
Posts: 10
You stack trace looks very similar to what I remember while debugging, but I never got the error you are experiancing. The are two possible workarounds

Set the following Tree cache setting, this effectivly disables locking in TreeCache, biggest impact is on state of cache during a rollback, as cache may conatin the uncommited data, unsure of this though.

<attribute name="IsolationLevel">NONE</attribute>

Second option is to disable the Hiberate Query Cache, which has a detrimatal impact on performance, but wont lave the cache in un unknow state. This setting I think is the cause of the issue.

<attribute name="QueryCacheEnabled">false</attribute>

Not sure how to raise this to a higher level, any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 22, 2004 8:09 am 
Beginner
Beginner

Joined: Mon Aug 16, 2004 6:09 am
Posts: 46
Location: Geneva, Switzerland
youngm77 wrote:
Have you recieved any help with this issue? I appear to be experiencing a similar problem with hibernate attempting to place items in TreeCache after the transaction has been committed. I get the exception:

java.lang.IllegalStateException: Already committed.
at org.jboss.tm.TransactionImpl.registerSynchronization(TransactionImpl.java:702)
at org.jboss.cache.TreeCache.getCurrentTransaction(TreeCache.java:2592)
at org.jboss.cache.TreeCache.put(TreeCache.java:1329)
at net.sf.hibernate.cache.TreeCache.put(TreeCache.java:67)
at net.sf.hibernate.cache.UpdateTimestampsCache.invalidate(UpdateTimestampsCache.java:52)
at net.sf.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:605)
at net.sf.hibernate.engine.CacheSynchronization.afterCompletion(CacheSynchronization.java:29)
at org.jboss.tm.TransactionImpl.doAfterCompletion(TransactionImpl.java:1398)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:421)
at org.jboss.tm.TxManager.commit(TxManager.java:142)
at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:126)

This appears to leave TreeCache in an unknown lock state because when I attempt to execute the operation again I get a lock exception.

Any ideas? This problem is killing me. :)

Mike


What version of jboss-hibernate.jar you're using? Some time ago there was a bug where hibernate's flush() was called in TransactionSync.afterCompletion() instead of beforeCompletion() - which is definitely causes the exception you got. In current version (shipped with releases 4.0 and 3.2.6) it is fixed.


Top
 Profile  
 
 Post subject: Re: JBoss Cache Commit with UseQueryCache=true Issue
PostPosted: Fri Oct 22, 2004 8:30 am 
Beginner
Beginner

Joined: Mon Aug 16, 2004 6:09 am
Posts: 46
Location: Geneva, Switzerland
Code:
2004-10-18 14:29:34,734 ERROR [net.sf.hibernate.impl.SessionImpl] Could not synchronize database state with session
net.sf.hibernate.cache.CacheException: org.jboss.cache.lock.TimeoutException: lock could not be acquired after 15000 ms. Lock map ownership Read lock owners: []
Write lock owner: <primary:3279>:15
at caw.util.hibernate.cache.JBossTreeCache.put(JBossTreeCache.java:75)
at net.sf.hibernate.cache.UpdateTimestampsCache.preinvalidate(UpdateTimestampsCache.java:42)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2413)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2368)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
...



Mark, I have exactly the same problem at the moment (btw I'm also using my own version of TreeCacheProvider to lookup for separately deployed cache, although this is not the source of the problem). By now I see that this bug appears only when <cache usage="read-only"/> is set, when it is "transactional" - problem disappears (I run into it caching hibernate entities, not query results).
I'm now trying to sort it out. Can someone explain the diffenence between "read-only" and "transactional" on terms of how hibernate deals with them, besides now allowing to change read-only entities? Maybe someone from the hibernate team can say a couple of words?
For example, why net.sf.hibernate.cache.TransactionalCache has no differences with net.sf.hibernate.cache.ReadOnlyCache besides only one - in ReadOnlyCache put() and get() are synchronized?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 22, 2004 11:15 am 
Regular
Regular

Joined: Thu Aug 26, 2004 9:23 pm
Posts: 71
I'm currently using JBoss 3.2.6 with Hibernate 2.1.6 and JbossCache 1.1.
I'm deploying Hibernate as a SAR.

I did some checking and realized I unknowingly had query cache enabled so I disabled that and it appears to work fine now.

Thanks,
Mike


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 23, 2004 8:52 am 
Newbie

Joined: Fri Sep 10, 2004 9:46 am
Posts: 10
Quote:
What version of jboss-hibernate.jar you're using? Some time ago there was a bug where hibernate's flush() was called in TransactionSync.afterCompletion() instead of beforeCompletion() - which is definitely causes the exception you got. In current version (shipped with releases 4.0 and 3.2.6) it is fixed.


I started out using the jboss-hibernate.jar shipping with JBoss 4.0.0, saw the post about the TransactionSync.afterCompletion() bug, fixed this by copying the repaired classes into my source (rather than rebuilding JBoss) but the issue still exists.

Quote:
Mark, I have exactly the same problem at the moment (btw I'm also using my own version of TreeCacheProvider to lookup for separately deployed cache, although this is not the source of the problem). By now I see that this bug appears only when <cache usage="read-only"/> is set, when it is "transactional" - problem disappears (I run into it caching hibernate entities, not query results).


I also use a custom TreeCacheProvider that looks up the Cache in JNDI, deployed using MBean service.xml. I have mixed cache-usage="read-only" and "transactinal", will try replacing "read-only" with "transactional" and let you know.

Quote:
I'm now trying to sort it out. Can someone explain the diffenence between "read-only" and "transactional" on terms of how hibernate deals with them, besides now allowing to change read-only entities? Maybe someone from the hibernate team can say a couple of words?
For example, why net.sf.hibernate.cache.TransactionalCache has no differences with net.sf.hibernate.cache.ReadOnlyCache besides only one - in ReadOnlyCache put() and get() are synchronized?


IMHO the reason may be is that hibernate doesnt control transactions in the Cache, this control is taken away when JTA is used, so everthing in Cache happens as part of the transaction, "read-only" or not. What do you think?

Can anyone else shed some light

Mark.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 25, 2004 10:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
I started out using the jboss-hibernate.jar shipping with JBoss 4.0.0, saw the post about the TransactionSync.afterCompletion() bug, fixed this by copying the repaired classes into my source (rather than rebuilding JBoss) but the issue still exists.

This would have no effect. You need to patch the jboss install directly. Really it's just the JBoss "hibernate" module that needs to be rebuilt. Get the source, build the hibernate module and replace the jboss-hibernate.jar with the new one resulting from the build.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 29, 2004 11:58 am 
Newbie

Joined: Fri Oct 29, 2004 11:36 am
Posts: 1
steve wrote:
This would have no effect. You need to patch the jboss install directly. Really it's just the JBoss "hibernate" module that needs to be rebuilt. Get the source, build the hibernate module and replace the jboss-hibernate.jar with the new one resulting from the build.


I encountered the same problem using JBoss-4.0.0, Hibernate and JBoss Cache with the UseQueryCache = true. The problem still persists after using the latest snapshots of Hibernate, JBoss Cache and jboss-hibernate.jar from CVS. The same problem appears when I use the Spring


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 29, 2004 12:27 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
This is a known issue in Hibernate (search the forums/JIRA) when using query caching and transactional caching. It has nothing to do with the integration code.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 29, 2004 12:30 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
No, this is not a known issue. The last time this error message came up we couldn't find any problem. We also didn't have a proper bug report. Please, if you are absolutely sure that your setup is correct (you have JTATransactionFactory and the correct TransactionManagerLookup, right?) then post a simplified test case to JIRA.

Thanks

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 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.