[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-4251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17306499#comment-17306499
 ] 

Mohammad Arshad commented on ZOOKEEPER-4251:
--------------------------------------------

Failing test cases generally log error message as 

{noformat}
java.lang.AssertionError: Unexpected bean exists! expected:<0> but was:<1>
        at org.apache.zookeeper.test.WatcherTest.setUp(WatcherTest.java:84)

2021-03-11 05:38:43,909 [myid:] - INFO  [main:JMXEnv@145] - 
unexpected:org.apache.ZooKeeperService:name0=ReplicatedServer_id7,name1=replica.7,name2=Follower,name3=InMemoryDataTree
2021-03-11 05:38:43,909 [myid:] - ERROR [main:ZKTestCase$1@101] - FAILED 
testWatcherCounte
{noformat}

JMX Bean name0=ReplicatedServer_id7 indicates that QuorumBean is not cleared 
from a server with id 7.  In test cases servers ids are starting with 1. So 
this means this QuorumBean is not registered from test cases which is starting 
7 servers. In whole zk I can find two test cases which are starting 7 servers 
* ReconfigTest.testBulkReconfig
* ReconfigTest.testQuorumSystemChange

So definitely these test cases some how not cleaning up the QuorumBean. 

I checked code, QuorumBean is cleaned when Quorum is shutdown
{code:java}
} finally {
            LOG.warn("QuorumPeer main thread exited");
            MBeanRegistry instance = MBeanRegistry.getInstance();
            instance.unregister(jmxQuorumBean);
            instance.unregister(jmxLocalPeerBean);

            for (RemotePeerBean remotePeerBean : jmxRemotePeerBean.values()) {
                instance.unregister(remotePeerBean);
            }

            jmxQuorumBean = null;
            jmxLocalPeerBean = null;
            jmxRemotePeerBean = null;
        }
{code}

Above two test are shutting down the 7th servers, so this jmxQuorumBean from 
7th servers should be cleaned up. But somehow this is not happening.





> Flaky test: org.apache.zookeeper.test.WatcherTest
> -------------------------------------------------
>
>                 Key: ZOOKEEPER-4251
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4251
>             Project: ZooKeeper
>          Issue Type: Sub-task
>            Reporter: Mohammad Arshad
>            Priority: Major
>         Attachments: image-2021-03-16-12-24-27-480.png
>
>
> Flakyness=73.3% (11 / 15)     
>  !image-2021-03-16-12-24-27-480.png! 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to