4 Replies Latest reply on Oct 7, 2011 11:25 AM by galder.zamarreno

    Unable to acquire lock

    nikolay1981

      Hi,

       

      Two nodes running on the same machine. (v4.2.1)

      The frst node reads data from AtomicMap. The second node puts data into the same AtomicMap.

       

      I'm getting on the reader's side:

      org.infinispan.util.concurrent.TimeoutException: Unable to acquire lock after [10 seconds] on key [my_atomic_map_key] for requestor [GlobalTransaction:<nykdwm2056268-2968>:1:remote]! Lock held by [GlobalTransaction:<nykdwm2056268-13254>:3016:local]
                at org.infinispan.container.EntryFactoryImpl.acquireLock(EntryFactoryImpl.java:228)
      
      

      On the writer's side:

      javax.transaction.RollbackException: Exception rolled back, status is: 9
                at org.infinispan.transaction.tm.DummyTransaction.commit(DummyTransaction.java:92)
                at org.infinispan.transaction.tm.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:96)
                at InfiniCacheBenchmarkWrite.main(InfiniCacheBenchmarkWrite.java:52)
      

       

      Reader freezes at cache.getAdvancedCache().lock("my_atomic_map_key");

      After 10 sec I get the exception above.

      Reader:

      for (;;) {
                Object lastKey = null;
                tm.begin();
                log("Lock");
                cache.getAdvancedCache().lock("my_atomic_map_key");
                map = AtomicMapLookup.getAtomicMap(cache, "my_atomic_map_key");
                log("Read");
                for(Object key : (Set)map.keySet()){
                          lastKey = key;
                }
                log("Commit");
                tm.commit();
      }
      

       

      Writer:

                  for (int i = 0 ; i < 2000; i++) {
                      tm.begin();
                      map.put("" + i, i);
                      tm.commit();
                  }
      

          

       

      <default>
                <jmxStatistics enabled="true"/>
                <clustering mode="replication">
                          <sync/>
                          <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
                </clustering>
                <transaction
                                    transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
                                    syncRollbackPhase="true"
                                    syncCommitPhase="true"
                                    useEagerLocking="true"/>
                <invocationBatching enabled="true"/>
      </default>
      

       

      Could you clarify please? Why does Reader hang on .lock call?

      Thank you