ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-1351

invalid test verification in MultiTransactionTest

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.4.0
    • Fix Version/s: 3.4.3, 3.5.0
    • Component/s: tests
    • Labels:
      None

      Description

      tests such as org.apache.zookeeper.test.MultiTransactionTest.testWatchesTriggered() are incorrect. Two issues I see

      1) zk.sync is async, there is no guarantee that the watcher will be called subsequent to sync returning

              zk.sync("/", null, null);
              assertTrue(watcher.triggered); /// incorrect assumption
      

      The callback needs to be implemented, only once the callback is called can we verify the trigger.

      2) trigger is not declared as volatile, even though it will be set in the context of a different thread (eventthread)

      See https://builds.apache.org/view/S-Z/view/ZooKeeper/job/ZooKeeper-trunk-solaris/91/testReport/junit/org.apache.zookeeper.test/MultiTransactionTest/testWatchesTriggered/
      for an example of a false positive failure

      junit.framework.AssertionFailedError
      	at org.apache.zookeeper.test.MultiTransactionTest.testWatchesTriggered(MultiTransactionTest.java:236)
      	at org.apache.zookeeper.JUnit4ZKTestRunner$LoggedInvokeMethod.evaluate(JUnit4ZKTestRunner.java:52)
      
      1. ZOOKEEPER-1351_br34.patch
        6 kB
        Patrick Hunt
      2. ZOOKEEPER-1351.patch
        5 kB
        Patrick Hunt

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Patrick Hunt
            Reporter:
            Patrick Hunt
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development