ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-783

committedLog in ZKDatabase is not properly synchronized

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 3.3.1
    • Fix Version/s: 3.3.2, 3.4.0
    • Component/s: server
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      ZKDatabase.getCommittedLog() returns a reference to the LinkedList<Proposal> committedLog in ZKDatabase. This is then iterated over by at least one caller.

      I have seen a bug that causes a NPE in LinkedList.clear on committedLog, which I am pretty sure is due to the lack of synchronization. This bug has not been apparent in normal ZK operation, but in code that I have that starts and stops a ZK server in process repeatedly (clear() is called from ZooKeeperServerMain.shutdown()).

      It's better style to defensively copy the list in getCommittedLog, and to synchronize on the list in ZKDatabase.clear.

      1. ZOOKEEPER-783.patch
        0.8 kB
        Henry Robinson

        Activity

        Henry Robinson created issue -
        Henry Robinson made changes -
        Field Original Value New Value
        Attachment ZOOKEEPER-783.patch [ 12446054 ]
        Patrick Hunt made changes -
        Assignee Henry Robinson [ henryr ]
        Fix Version/s 3.3.2 [ 12315108 ]
        Fix Version/s 3.4.0 [ 12314469 ]
        Mahadev konar made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Mahadev konar made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Hadoop Flags [Reviewed]
        Resolution Fixed [ 1 ]
        Mahadev konar made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Henry Robinson
            Reporter:
            Henry Robinson
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development