I'm actually using the WriteLock from the ZookeeperNetEx C# code but I've 
verified that the same issue exists in the Java recipe.  On a busy system, I'm 
fairly frequently seeing WriteLock that is never granted to client and gets 
stuck.

What I believe is happening is the lock sets a watch on the request before him 
via this code:

                            Stat stat = zookeeper.exists(lastChildId, new 
LockWatcher());
                            if (stat != null) {
                                return Boolean.FALSE;
                            } else {
                                LOG.warn("Could not find the" +
                                                                " stats for 
less than me: " + lastChildName.getName());
                            }

The problem (as I see it and I'm still fairly new to Zookeeper) is that if the 
node represented by lastChildId has been deleted before the call to exists is 
made, stat will return null and the watch will only ever be invoked when the 
znode is created.  And of course that will never happen.

The message is appearing in my log and my watcher for the lock is never invoked.

[2018-02-13 16:49:17.905 GMT    WARNING         WriteLock       Could not find 
the stats for less than me: 
/token/SegmentProfileQueueToken/x-72057953399865370-0000000724]

I'm not entirely sure of the proper way of fixing this but I think setting
    Id = null;
When stat is null should work.

Can someone verify if my analysis is correct?

--
Kathryn Hogg
Senior Manager Product Development
Phone: 763.201.2000
Fax: 763.201.5333
Open Access Technology International, Inc.
3660 Technology Drive NE, Minneapolis, MN 55418

CONFIDENTIAL INFORMATION: This email and any attachment(s) contain confidential 
and/or proprietary information of Open Access Technology International, Inc.  
Do not copy or distribute without the prior written consent of OATI.  If you 
are not named a recipient to the message, please notify the sender immediately 
and do not retain the message in any form, printed or electronic.

Reply via email to