zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maoling <...@git.apache.org>
Subject [GitHub] zookeeper pull request #584: ZOOKEEPER-3102: Potential race condition when c...
Date Sun, 29 Jul 2018 05:53:10 GMT
Github user maoling commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/584#discussion_r205961633
  
    --- Diff: src/java/main/org/apache/zookeeper/server/DataTree.java ---
    @@ -478,7 +478,10 @@ public void createNode(final String path, byte data[], List<ACL>
acl,
                     HashSet<String> list = ephemerals.get(ephemeralOwner);
                     if (list == null) {
                         list = new HashSet<String>();
    -                    ephemerals.put(ephemeralOwner, list);
    +                    HashSet<String> _list;
    +                    if ((_list = ephemerals.putIfAbsent(ephemeralOwner, list)) != null)
{
    +                        list = _list;
    +                    }
                     }
                     synchronized (list) {
    --- End diff --
    
    @anmolnar 
    I will test it with that unit test , using a 'threadpool' and create 1000000 nodes to
reproduce what I guess。
    I wish I was wrong,but if i'm right ,you need to watch Breaking Bad series (smirk).
    



---

Mime
View raw message