Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
3.4.6
-
None
-
None
-
Cluster (multi-server) setup
Description
The parameter, electionAlgo, is supposed to be 0--3. However, when I mistyped the value in my zoo.cfg (I'm stupid), ZK falls into a dead loop and starts filling up the entire disk which millions of the follow 2 lines...
2014-11-14 14:28:44,588 [myid:3] - INFO [QuorumPeer[myid=3]/0:0:0:0:0:0:0:0:2183:QuorumPeer@714] - LOOKING
2014-11-14 14:28:44,588 [myid:3] - WARN [QuorumPeer[myid=3]/0:0:0:0:0:0:0:0:2183:QuorumPeer@764] - Unexpected exception
java.lang.NullPointerException
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:762)
The error rooted in createElectionAlgorithm() where an invalid setting leads to null for the Election object. Then, in the while look in run(), it causes null-pointer de-referencing which is captured but is not handled well.
I think our should check the setting of electionAlg in the very beginning to make sure it's a valid setting, instead of using it at runtime and cause the unfortunate things.
Let me know if you wanna a patch. I'd like to check it in the parseProperties() function in QuorumPeerConfig.java.
Thanks!