[ https://issues.apache.org/jira/browse/ZOOKEEPER-2383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15206169#comment-15206169 ]
Rakesh R commented on ZOOKEEPER-2383: ------------------------------------- Thanks [~jbrosenb...@gmail.com]. Disbaling or mocking may affect the {{org.apache.zookeeper.testJMXEnv#ensureAll(expectednames)}} verification, isn't it?. In unit tests, it verifies all the registered jmx beans to ensure that the server is started fully. [~fpj], I have one idea to fix this issue by modifying the condition {{zkServer == null}} with {{zkServer.isRunning()}} status check. After seeing the code changes, I feel to push this logic carefully after 3.5.2 release, which is waiting to be released soon. Also, I think needs to identify and add more unit test cases covering server startup/shutdown/restart corner cases in order to push this change. Now, I'm planning to revert ZOOKEEPER-2026 committed changes and re-open the jira. Does this makes sense to you? > Startup race in ZooKeeperServer > ------------------------------- > > Key: ZOOKEEPER-2383 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2383 > Project: ZooKeeper > Issue Type: Bug > Components: jmx, server > Affects Versions: 3.4.8 > Reporter: Steve Rowe > Priority: Blocker > Fix For: 3.4.9 > > Attachments: TestZkStandaloneJMXRegistrationRaceConcurrent.java, > release-3.4.8-extra-logging.patch, zk-3.4.8-MBeanRegistry.log, > zk-3.4.8-NPE.log > > > In attempting to upgrade Solr's ZooKeeper dependency from 3.4.6 to 3.4.8 > (SOLR-8724) I ran into test failures where attempts to create a node in a > newly started standalone ZooKeeperServer were failing because of an assertion > in MBeanRegistry. > ZooKeeperServer.startup() first sets up its request processor chain then > registers itself in JMX, but if a connection comes in before the server's JMX > registration happens, registration of the connection will fail because it > trips the assertion that (effectively) its parent (the server) has already > registered itself. > {code:java|title=ZooKeeperServer.java} > public synchronized void startup() { > if (sessionTracker == null) { > createSessionTracker(); > } > startSessionTracker(); > setupRequestProcessors(); > registerJMX(); > state = State.RUNNING; > notifyAll(); > } > {code} > {code:java|title=MBeanRegistry.java} > public void register(ZKMBeanInfo bean, ZKMBeanInfo parent) > throws JMException > { > assert bean != null; > String path = null; > if (parent != null) { > path = mapBean2Path.get(parent); > assert path != null; > } > {code} > This problem appears to be new with ZK 3.4.8 - AFAIK Solr never had this > issue with ZK 3.4.6. -- This message was sent by Atlassian JIRA (v6.3.4#6332)