[ https://issues.apache.org/jira/browse/SOLR-17478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17887709#comment-17887709 ]
David Smiley commented on SOLR-17478: ------------------------------------- I like that you thought of a suggestion that doesn't bloat our base test classes :) > ZkTestServer bugs can cause 30sec test pauses > --------------------------------------------- > > Key: SOLR-17478 > URL: https://issues.apache.org/jira/browse/SOLR-17478 > Project: Solr > Issue Type: Test > Security Level: Public(Default Security Level. Issues are Public) > Reporter: Chris M. Hostetter > Priority: Major > > Pop Quiz: which of these two (psuedo-code) ZK based test classes will be > faster... > {code:java} > public class Test_X extends SolrTestCase { > public void test() throws Exception { > ZkTestServer zkServer = new ZkTestServer(createTempDir()); > zkServer.run(); > zkServer.shutdown(); > } > } > public class Test_Y extends SolrTestCaseJ4 { > public void test() throws Exception { > ZkTestServer zkServer = new ZkTestServer(createTempDir()); > zkServer.run(); > zkServer.shutdown(); > } > } > {code} > ...if you guessed "Test_X, because SolrTestCase has less overhead then > SolrTestCaseJ4" then you are *wrong by ~30 seconds.* > Actually, that's not _always_ true: if you run both tests in the same JVM > then they will both take the same amount of time: > * If Test_Y runs first, they will both take ~1 second each > * If Test_X runs first, they will both take 30+ seconds *_each_* > The reason for the dependency comes down to: > * The {{"zookeeper.4lw.commands.whitelist"}} sysprop is set/cleared in > SolrTestCaseJ4 (BeforeClass/AfterClass), but _NOT_ in SolrTestCase > * ZkTestServer depends on the ZK helper methods > {{ClientBase.waitForServerUp()}} which depends on the 4LW {{"stat"}} being > whitelisted > ** If "stat" is not whitelisted, then {{waitForServerUp()}} timesout after > 30 sec and return a failure > ** Bonus problem: ZkTestServer never checks of the return value of > {{waitForServerUp()}} ! > * Zookeeper only checks for the 4LW whitelist sysprop the first time it's > needed by the {{FourLetterCommands}} class _and then caches it staticly_ > ** So if the first testclass to run a ZK server doesn't extend > SolrTestCaseJ4, then _every_ test that uses ZkTestServer in that JVM will > stall for 30 seconds -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org