Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1351

invalid test verification in MultiTransactionTest

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.4.3, 3.5.0
    • tests
    • 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)
      

      Attachments

        1. ZOOKEEPER-1351_br34.patch
          6 kB
          Patrick D. Hunt
        2. ZOOKEEPER-1351.patch
          5 kB
          Patrick D. Hunt

        Activity

          People

            phunt Patrick D. Hunt
            phunt Patrick D. Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: