TestZooKeeperNodeTracker sometimes fails due to a race condition in test
notification
-------------------------------------------------------------------------------------
Key: HBASE-3252
URL: https://issues.apache.org/jira/browse/HBASE-3252
Project: HBase
Issue Type: Bug
Affects Versions: 0.90.0
Reporter: Gary Helmling
Priority: Minor
TestZooKeeperNodeTracker sometimes fails with errors like the following:
{noformat}
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.738 sec <<<
FAILURE!
testNodeTracker(org.apache.hadoop.hbase.zookeeper.TestZooKeeperNodeTracker)
Time elapsed: 0.17 sec <<< FAILURE!
java.lang.AssertionError:
at org.junit.Assert.fail(Assert.java:91)
at org.junit.Assert.assertTrue(Assert.java:43)
at org.junit.Assert.assertTrue(Assert.java:54)
at
org.apache.hadoop.hbase.zookeeper.TestZooKeeperNodeTracker.testNodeTracker(TestZooKeeperNodeTracker.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
{noformat}
Running the test locally this can happen as much as 25-50% of the time.
It looks like this is due to a basic race condition in the way the test is
structured. The test code uses:
{code}
// Wait for zk event to be processed
zkListener.waitForDataChange();
{code}
But, since zkListener is instantiated (and registered with ZooKeeperWatcher)
prior to secondTracker (which is always the source of the failure), zkListener
will be notified first of the change and there is a race condition between the
subsequent test assertions and the secondTracker notification.
Attaching a patch with a simple fix of just instantiating secondTracker prior
to zkListener so that it's registered (and notified) first.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.