Details
Description
Kafka broker kept on restarting itself. Exceptions are shown in server.log:
[2014-03-28 15:09:01,624] INFO Will not load MX4J, mx4j-tools.jar is not in the classpath (kafka.utils.Mx4jLoader$)
[2014-03-28 15:09:01,635] INFO conflict in /controller data: 2108872 stored data:
(kafka.utils.ZkUtils$)
[2014-03-28 15:09:01,638] FATAL Fatal error during KafkaServerStable startup. Prepare to shutdown (kafka.server.KafkaServerStartable)
java.lang.NumberFormatException: For input string: "
"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:481)
at java.lang.Integer.parseInt(Integer.java:514)
at scala.collection.immutable.StringLike$class.toInt(StringLike.scala:207)
at scala.collection.immutable.StringOps.toInt(StringOps.scala:31)
at kafka.server.ZookeeperLeaderElector.elect(ZookeeperLeaderElector.scala:60)
at kafka.server.ZookeeperLeaderElector.startup(ZookeeperLeaderElector.scala:43)
at kafka.controller.KafkaController.startup(KafkaController.scala:396)
at kafka.server.KafkaServer.startup(KafkaServer.scala:96)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:34)
at kafka.Kafka$.main(Kafka.scala:46)
at kafka.Kafka.main(Kafka.scala)
[2014-03-28 15:09:01,639] INFO [Kafka Server 2108872], Shutting down (kafka.server.KafkaServer)
[2014-03-28 15:09:01,640] INFO Closing zookeeper client... (kafka.server.KafkaZooKeeper)
[2014-03-28 15:09:01,644] INFO [Socket Server on Broker 2108872], Shutting down (kafka.network.SocketServer)
[2014-03-28 15:09:01,648] INFO [Socket Server on Broker 2108872], Shutdown completed (kafka.network.SocketServer)
I checked the source code, there are bugs in code:
https://git-wip-us.apache.org/repos/asf?p=kafka.git;a=blob;f=core/src/main/scala/kafka/server/ZookeeperLeaderElector.scala;h=33b73609b1178c56e692fb60e35aca04ad1af586;hb=8e554c4d2acf5108805905b9f06198f20398ee3a
In ZookeeperLeaderElector.scala line 57, Int brokerId is passed in as fourth parameter, while in ZkUtils.scala line 307, the declaration for the fourth paramenter is expectedCallerData: Any.