[jboss-jira] [JBoss JIRA] (JGRP-2220) Two nodes can own a same lock at same time

Xiao Li (JIRA) issues at jboss.org
Fri Sep 22 15:44:00 EDT 2017


Xiao Li created JGRP-2220:
-----------------------------

             Summary: Two nodes can own a same lock at same time
                 Key: JGRP-2220
                 URL: https://issues.jboss.org/browse/JGRP-2220
             Project: JGroups
          Issue Type: Bug
    Affects Versions: 3.4
         Environment: Two nodes cluster with jgroup 3.4.0 alpha2
            Reporter: Xiao Li
            Assignee: Bela Ban


We have a two node cluster with following protocol stack for distributed lock. 
lock.protocolStack=UDP(bind_addr=myIP;bind_port=31562;mcast_addr=239.255.166.17;mcast_port=31569;ip_ttl=32;mcast_send_buf_size=150000;mcast_recv_buf_size=80000):PING(timeout=2000;num_initial_members=3):MERGE2(min_interval=5000;max_interval=10000):FD_ALL(interval=5000;timeout=20000):VERIFY_SUSPECT(timeout=1500):pbcast.NAKACK(retransmit_timeout=300,600,1200,2400,4800):UNICAST(timeout=5000):pbcast.STABLE(desired_avg_gossip=20000):FRAG(frag_size=8096):pbcast.GMS(join_timeout=5000;print_local_addr=true):CENTRAL_LOCK(num_backups=2)

We use the  following call to get a lock for one node.
lock = lockManager.getLock(lockId);
lock.tryLock(Long.MAX_VALUE, TimeUnit.MILLISECONDS); where lockManager is an object of LockService and lock is a Lock object.
Another node is waiting on the lock at same method call.  When the node owning the lock release the lock with the call lock.unlock(), the node waiting on the lock gets the lock and the lock is deleted from the node owned the lock. When the JVM for the node that released the lock restarted, it can also get same lock. So two nodes own the lock at same time. 

  If I don't call lock.unlock() before shutting down the node, it waits for the lock as expected when its JVM starts up. 




--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list