You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Gary Helmling (JIRA)" <ji...@apache.org> on 2010/11/19 21:31:13 UTC

[jira] Created: (HBASE-3252) TestZooKeeperNodeTracker sometimes fails due to a race condition in test notification

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.


[jira] Updated: (HBASE-3252) TestZooKeeperNodeTracker sometimes fails due to a race condition in test notification

Posted by "Gary Helmling (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-3252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Helmling updated HBASE-3252:
---------------------------------

    Attachment: HBASE-3252.patch

Trivial patch to make the test reliably pass.  Just moves secondTracker registration ahead of zkListener.

> 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
>         Attachments: HBASE-3252.patch
>
>
> 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.


[jira] Resolved: (HBASE-3252) TestZooKeeperNodeTracker sometimes fails due to a race condition in test notification

Posted by "Andrew Purtell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-3252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Purtell resolved HBASE-3252.
-----------------------------------

      Resolution: Fixed
    Hadoop Flags: [Reviewed]

Committed. Thanks for the patch Gary.

> 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
>          Components: test
>    Affects Versions: 0.90.0
>            Reporter: Gary Helmling
>            Priority: Minor
>             Fix For: 0.90.0
>
>         Attachments: HBASE-3252.patch
>
>
> 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.


[jira] Updated: (HBASE-3252) TestZooKeeperNodeTracker sometimes fails due to a race condition in test notification

Posted by "Gary Helmling (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-3252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Helmling updated HBASE-3252:
---------------------------------

      Component/s: test
    Fix Version/s: 0.90.0

The problem fixed is only with the test code itself, not the underlying ZK notification, so it's not critical.  But marking for 0.90.0 so that we can get all tests passing on hudson.  Feel free to boot it if you disagree.

> 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
>          Components: test
>    Affects Versions: 0.90.0
>            Reporter: Gary Helmling
>            Priority: Minor
>             Fix For: 0.90.0
>
>         Attachments: HBASE-3252.patch
>
>
> 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.