1 Reply Latest reply: Nov 9, 2010 8:32 AM by Manik Surtani RSS

Different results from aquiring a lock

Lin Ye Novice

I am testing with cluster wide eager locking. One case I tested is:

  1. Start two cache instances in two processes, and try to aquire a lock on the same key in both processess.
  2. After the first process aquires the lock, kill the process to see if the lock would released and the second process could aquire the lock.

 

My test showed that the lock got released. However, I saw two different behaviors from time to time. In one case, the second process aquired the lock after the first process got killed without any exception. In another case, the second process got the following JGroups exception, and I have to retry aquiring lock after the exception throwed to gain the lock. Is it the desired behavior? Does it mean I have to catch the JGroups exception and retry aquiring lock if I'd like to get the lock in case the lock owner dies?

org.infinispan.remoting.transport.jgroups.SuspectException: Suspected member: T00696119-26017
        at org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:418)
        at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:100)
        at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:124)
        at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:229)
        at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:216)
        at org.infinispan.remoting.rpc.RpcManagerImpl.broadcastRpcCommand(RpcManagerImpl.java:199)
        at org.infinispan.interceptors.base.BaseRpcInterceptor.visitLockControlCommand(BaseRpcInterceptor.java:59)
        at org.infinispan.commands.control.LockControlCommand.acceptVisitor(LockControlCommand.java:135)
        at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
        at org.infinispan.interceptors.LockingInterceptor.visitLockControlCommand(LockingInterceptor.java:149)
        at org.infinispan.commands.control.LockControlCommand.acceptVisitor(LockControlCommand.java:135)
        at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
        at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:132)
        at org.infinispan.commands.AbstractVisitor.visitLockControlCommand(AbstractVisitor.java:147)
        at org.infinispan.commands.control.LockControlCommand.acceptVisitor(LockControlCommand.java:135)
        at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
        at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:171)
        at org.infinispan.interceptors.TxInterceptor.visitLockControlCommand(TxInterceptor.java:115)
        at org.infinispan.commands.control.LockControlCommand.acceptVisitor(LockControlCommand.java:135)
        at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
        at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:132)
        at org.infinispan.commands.AbstractVisitor.visitLockControlCommand(AbstractVisitor.java:147)
        at org.infinispan.commands.control.LockControlCommand.acceptVisitor(LockControlCommand.java:135)
        at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
        at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:57)
        at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:38)
        at org.infinispan.commands.AbstractVisitor.visitLockControlCommand(AbstractVisitor.java:147)
        at org.infinispan.commands.control.LockControlCommand.acceptVisitor(LockControlCommand.java:135)
        at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:273)
        at org.infinispan.CacheDelegate.lock(CacheDelegate.java:299)
        at org.infinispan.CacheDelegate.lock(CacheDelegate.java:292)
        at CacheInstance.main(CacheInstance.java:67)