3 Replies Latest reply on Nov 28, 2005 9:20 AM by Ales Justin

    IdentityLock exception while using JBossCache and Hibernate

    jaikiran pai Master

      Hi,
      While using PESSIMISTIC locking approach with JBossCache1.2 and Hibernate2.1.3 in our application, in JBoss-3.2.3, we frequently see the following exceptions:

      10:16:29,999 ERROR [IdentityLock] write lock for //com/dbdata/measureeditor/hibernateobject/MsMeasure/com.dbdata.measureeditor.hibernateobject.MsMeasureId@15add68[id: =101,versionId: =1] could not be acquired after 15000 ms. Lock map ownership Read lock owners: [<null>:5]
      Write lock owner: <null>:3
       (caller=<null>:4)


      In the treecache.xml we have specified the value for LockAcquisitionTimeout attribute as 15000.

      My question is, does increasing this attribute to a very high value(say 400000) have any adverse effects on the application?

      Thank you.




        • 1. Re: IdentityLock exception while using JBossCache and Hibern
          Manik Surtani Master

          yes, in that it may mean that hung threads could attempt to wait for locks for quite a long time (effectively hanging your app) waiting for a lock if you are in a deadlock condition.

          • 3. Re: IdentityLock exception while using JBossCache and Hibern
            Ales Justin Master

            I'm using cache with EJB3 (Hibernate3.1). All pojos used have 'transactional' cache concurrency strategy.

            I also get the following exception:

            15:16:06,359 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
            15:16:06,359 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
            15:16:06,375 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
            15:16:06,421 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
            15:16:06,421 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
            15:16:06,437 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
            15:16:06,453 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
            15:16:06,468 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
            15:16:06,500 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
            15:16:06,500 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)
            15:16:06,578 ERROR [IdentityLock] read lock for /mediumTime could not be acquired by Thread[http-0.0.0.0-8080-3,5,jboss] after 0 ms. Locks: Read lock owners: {}
            Write lock owner: GlobalTransaction::15
            , lock info: write owner=GlobalTransaction::15 (activeReaders=0, activeWriter=Thread[http-0.0.0.0-8080-3,5,jboss], waitingReaders=0, waitingWriters=0, waitingUpgrader=0)

            This is my cache mbean service file:

            <?xml version="1.0" encoding="UTF-8"?>
            
            <!-- ===================================================================== -->
            <!-- -->
            <!-- Sample TreeCache Service Configuration -->
            <!-- -->
            <!-- ===================================================================== -->
            
            <server>
            
             <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
            
            
             <!-- ==================================================================== -->
             <!-- Defines TreeCache configuration -->
             <!-- ==================================================================== -->
            
             <mbean code="org.jboss.cache.TreeCache"
             name="jboss.cache:service=EJB3TreeCache">
            
             <depends>jboss:service=Naming</depends>
             <depends>jboss:service=TransactionManager</depends>
            
             <!--
             Configure the TransactionManager
             -->
             <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
            
            
             <!--
             Node locking level : SERIALIZABLE
             REPEATABLE_READ (default)
             READ_COMMITTED
             READ_UNCOMMITTED
             NONE
             -->
             <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
            
             <!--
             Valid modes are LOCAL
             REPL_ASYNC
             REPL_SYNC
             -->
             <attribute name="CacheMode">LOCAL</attribute>
            
             <!-- Name of cluster. Needs to be the same for all clusters, in order
             to find each other
             -->
             <attribute name="ClusterName">TreeCache-Cluster</attribute>
            
             <!-- JGroups protocol stack properties. Can also be a URL,
             e.g. file:/home/bela/default.xml
             <attribute name="ClusterProperties"></attribute>
             -->
            
             <attribute name="ClusterConfig">
             <config>
             <!-- UDP: if you have a multihomed machine,
             set the bind_addr attribute to the appropriate NIC IP address -->
             <!-- UDP: On Windows machines, because of the media sense feature
             being broken with multicast (even after disabling media sense)
             set the loopback attribute to true -->
             <UDP mcast_addr="228.1.2.5" mcast_port="45577"
             ip_ttl="64" ip_mcast="true"
             mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
             ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
             loopback="false"/>
             <PING timeout="2000" num_initial_members="3"
             up_thread="false" down_thread="false"/>
             <MERGE2 min_interval="10000" max_interval="20000"/>
             <FD shun="true" up_thread="true" down_thread="true"/>
             <VERIFY_SUSPECT timeout="1500"
             up_thread="false" down_thread="false"/>
             <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
             up_thread="false" down_thread="false"/>
             <pbcast.STABLE desired_avg_gossip="20000"
             up_thread="false" down_thread="false"/>
             <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
             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="false" down_thread="false"/>
             </config>
             </attribute>
            
            
             <!--
             The max amount of time (in milliseconds) we wait until the
             initial state (ie. the contents of the cache) are retrieved from
             existing members in a clustered environment
             -->
             <attribute name="InitialStateRetrievalTimeout">20000</attribute>
            
             <!--
             Number of milliseconds to wait until all responses for a
             synchronous call have been received.
             -->
             <attribute name="SyncReplTimeout">15000</attribute>
            
             <!-- Max number of milliseconds to wait for a lock acquisition -->
             <attribute name="LockAcquisitionTimeout">10000</attribute>
            
            
             <!-- Name of the eviction policy class. Not supported now. -->
             <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
            
             <!-- Specific eviction policy configurations. This is LRU -->
             <attribute name="EvictionPolicyConfig">
             <config>
             <attribute name="wakeUpIntervalSeconds">5</attribute>
             <!-- Cache wide default -->
             <region name="/_default_">
             <attribute name="maxNodes">5000</attribute>
             <!-- Maximum time an object is kept in cache regardless of idle time; time from last change or visit
             and attribut must exist -->
             <attribute name="timeToLiveSeconds">3600</attribute>
             <attribute name="maxAgeSeconds">3600</attribute>
             </region>
            
             <!-- Cached objects -->
             <region name="/content">
             <attribute name="maxNodes">300</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/contentToMany">
             <attribute name="maxNodes">1000</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/pubCompParagraph">
             <attribute name="maxNodes">300</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/source">
             <attribute name="maxNodes">20</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/sourceExtra">
             <attribute name="maxNodes">100</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/category">
             <attribute name="maxNodes">10</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/topic">
             <attribute name="maxNodes">50</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/banner">
             <attribute name="maxNodes">20</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             <attribute name="maxAgeSeconds">600</attribute>
             </region>
            
             <region name="/keyword">
             <attribute name="maxNodes">200</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <!-- words and meanings -->
             <region name="/lexicon">
             <attribute name="maxNodes">200</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
             <!-- END cached objects -->
            
             <!-- Cached queries -->
             <region name="/final">
             <attribute name="maxNodes">10</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/navigation">
             <attribute name="maxNodes">500</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/lastCategoryContent">
             <attribute name="maxNodes">50</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/related">
             <attribute name="maxNodes">200</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
            
             <region name="/moreContent">
             <attribute name="maxNodes">200</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             </region>
             <!-- END cached queries -->
            
             <!-- START timed cached -->
             <region name="/longTime">
             <attribute name="maxNodes">200</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             <attribute name="maxAgeSeconds">86400</attribute> <!-- one day -->
             </region>
            
             <region name="/mediumTime">
             <attribute name="maxNodes">200</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             <attribute name="maxAgeSeconds">3600</attribute> <!-- one hour -->
             </region>
            
             <region name="/shortTime">
             <attribute name="maxNodes">200</attribute>
             <attribute name="timeToLiveSeconds">0</attribute>
             <attribute name="maxAgeSeconds">600</attribute> <!-- 10 min -->
             </region>
             <!-- END timed cached -->
             </config>
             </attribute>
            
             </mbean>
            
            </server>