Hello,
We are using JBoss Cache 1.3 for our project which is under development. Recently while
doing some performance testing we found a problem with the JDBC Cache Loader (we are using
an Oracle database as the backing store for our JBoss Cache). When we run with multiple
threads or sometimes even one thread, we get the following exception:
java.lang.RuntimeException: java.lang.IllegalStateException: Failed to insert node:
ORA-00001: unique constraint (FASTDEV.JBOSSCACHE_PK) violated at
org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4810)
at org.jboss.cache.TreeCache.put(TreeCache.java:3242)
at
com.sisl.ashleycomm.cache.CacheTimeoutManager.putCacheable(CacheTimeoutManager.java:452)
at
com.sisl.ashleycomm.cache.push.command.MobilePushCacheTimeoutManager.putCacheable(MobilePushCacheTimeoutManager.java:168)
at
com.sisl.ashleycomm.cache.DefaultCacheableVersionProxy.processEvent(DefaultCacheableVersionProxy.java:134)
at
com.sisl.ashleycomm.cache.push.command.MobilePushCacheTimeoutManager.getMobilePushCommandsForGprsSend
Caused by: java.lang.IllegalStateException: Failed to insert node: ORA-00001: unique
constraint (FASTDEV.JBOSSCACHE_PK) violated
at org.jboss.cache.loader.JDBCCacheLoader.insertNode(JDBCCacheLoader.java:982)
at org.jboss.cache.loader.JDBCCacheLoader.put(JDBCCacheLoader.java:325)
at
org.jboss.cache.interceptors.CacheStoreInterceptor.invoke(CacheStoreInterceptor.java:202)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at
org.jboss.cache.interceptors.CacheLoaderInterceptor.invoke(CacheLoaderInterceptor.java:187)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at
org.jboss.cache.interceptors.ReplicationInterceptor.invoke(ReplicationInterceptor.java:32)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:328)
at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:139)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at
org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:153)
at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4804)
Actually the scenario is like this:
A thread gets a node on the cache and then does some modification on the node and tries to
put it back on the cache.
There may be multiple threads accessing the same node.
Looking at the source code of JBoss Cache 1.3, I find that when put() is called on
JDBCCacheLoader, loadNode() method is called. Apparantly this is returning null so the
insertNode() is being called. But then when it tries to do the insertNode, it gets the PK
violated error which indicates the row was existing in the database already!!!
What are the precautions we need to take to avoid this problem? Is our setting wrong?
A quick reply would be very much appreciated. Please let me know if there are more details
required for diagnosing the problem
Thanks and Regards,
Archanaa Panda
Following are the details of our cache config xml file-
<attribute
name="TransactionManagerLookupClass">org.jboss.cache.DummyTransactionManagerLookup</attribute>
| <attribute name="IsolationLevel">READ_COMMITTED</attribute>
| <attribute name="CacheMode">REPL_SYNC</attribute>
|
|
| <attribute name="CacheLoaderConfiguration">
| <config>
| <passivation>false</passivation>
| <preload>/</preload>
| <shared>true</shared>
| <cacheloader>
| <class>org.jboss.cache.loader.JDBCCacheLoader</class>
| <properties>
| cache.jdbc.table.name=jbosscache
| cache.jdbc.table.create=true
| cache.jdbc.table.drop=false
| cache.jdbc.table.primarykey=jbosscache_pk
| cache.jdbc.fqn.column=fqn
| cache.jdbc.fqn.type=varchar(255)
| cache.jdbc.node.column=node
| cache.jdbc.node.type=blob
| cache.jdbc.parent.column=parent
| cache.jdbc.driver=oracle.jdbc.driver.OracleDriver
| cache.jdbc.url=jdbc:oracle:thin:@132.186.106.26:1541:ACRMDEV
| cache.jdbc.user=FASTDEV
| cache.jdbc.password=fastdev123$
| </properties>
| <async>false</async>
| <fetchPersistentState>true</fetchPersistentState>
| <ignoreModifications>false</ignoreModifications>
| </cacheloader>
| </config>
| </attribute>
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990965#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...