[
https://issues.apache.org/jira/browse/ZOOKEEPER-1864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13986444#comment-13986444
]
Rakesh R commented on ZOOKEEPER-1864:
-------------------------------------
Thanks [~michim] for the patch.
If I understood correctly the cause of NPE could be, not initialized the
'quorumVerifier' while parsing. But when looking at the code,
QPC.parseProperties() is getting called inside QPC.parse(path) and there is no
way of coming out without initializing 'quorumVerifier'. Any idea how the
curator-test has been written and starting the server ?
> quorumVerifier is null when creating a QuorumPeerConfig from parsing a
> Properties object
> ----------------------------------------------------------------------------------------
>
> Key: ZOOKEEPER-1864
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1864
> Project: ZooKeeper
> Issue Type: Bug
> Reporter: some one
> Assignee: Michi Mutsuzaki
> Fix For: 3.5.0
>
> Attachments: BackwardsCompatCheck.patch, ZOOKEEPER-1864.patch
>
>
> This bug was found when using ZK 3.5.0 with curator-test 2.3.0.
> curator-test is building a QuorumPeerConfig from a Properties object and then
> when we try to run the quorum peer using that configuration, we get an NPE:
> {noformat}
> 2014-01-19 21:58:39,768 [myid:] - ERROR
> [Thread-3:TestingZooKeeperServer$1@138] - From testing server (random state:
> false)
> java.lang.NullPointerException
> at
> org.apache.zookeeper.server.quorum.QuorumPeer.setQuorumVerifier(QuorumPeer.java:1320)
> at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:156)
> at
> org.apache.curator.test.TestingZooKeeperServer$1.run(TestingZooKeeperServer.java:134)
> at java.lang.Thread.run(Thread.java:722)
> {noformat}
> The reason that this happens is because QuorumPeerConfig:parseProperties only
> peforms a subset of what 'QuorumPeerConfig:parse(String path)' does. The
> exact additional task performed that we need in parseProperties is the
> dynamic config backwards compatibility check:
> {noformat}
> // backward compatibility - dynamic configuration in the same
> file as static configuration params
> // see writeDynamicConfig() - we change the config file to new
> format if reconfig happens
> if (dynamicConfigFileStr == null) {
> configBackwardCompatibilityMode = true;
> configFileStr = path;................
> parseDynamicConfig(cfg, electionAlg, true);
> checkValidity();................
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.2#6252)