Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
None
-
None
-
None
Description
The latest trunk codebase seems to expose a critical bug. Steps to reproduce on a fresh server:
1. git clone https://github.com/apache/kafka.git
cd kafka
gradle
./gradlew jar
2. bin/zookeeper-server-start.sh config/zookeeper.properties
3. bin/kafka-server-start.sh config/server.properties
4. bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
Step 4 causes this exception on the server:
[2016-12-02 14:54:54,597] ERROR [KafkaApi-0] Error when handling request {controller_id=0,controller_epoch=1,partition_states=[{topic=test,partition=0,controller_epoch=1,leader=0,leader_epoch=0,isr=[0],zk_version=0,replicas=[0]}],live_leaders=[{id=0,host=devstack1,port=9092}]} (kafka.server.KafkaApis) java.lang.NullPointerException at kafka.log.Log.logEndOffset(Log.scala:719) at kafka.log.Log$$anonfun$1.apply(Log.scala:113) at kafka.log.Log$$anonfun$1.apply(Log.scala:113) at kafka.utils.Logging$class.info(Logging.scala:70) at kafka.log.Log.info(Log.scala:86) at kafka.log.Log.<init>(Log.scala:112) at kafka.log.LogManager.createLog(LogManager.scala:374) at kafka.cluster.Partition.getOrCreateReplica(Partition.scala:95) at kafka.cluster.Partition$$anonfun$4$$anonfun$apply$2.apply(Partition.scala:176) at kafka.cluster.Partition$$anonfun$4$$anonfun$apply$2.apply(Partition.scala:176) at scala.collection.mutable.HashSet.foreach(HashSet.scala:79) at kafka.cluster.Partition$$anonfun$4.apply(Partition.scala:176) at kafka.cluster.Partition$$anonfun$4.apply(Partition.scala:170) at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:234) at kafka.utils.CoreUtils$.inWriteLock(CoreUtils.scala:242) at kafka.cluster.Partition.makeLeader(Partition.scala:170) at kafka.server.ReplicaManager$$anonfun$makeLeaders$4.apply(ReplicaManager.scala:756) at kafka.server.ReplicaManager$$anonfun$makeLeaders$4.apply(ReplicaManager.scala:755) at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:98) at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:98) at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:226) at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:39) at scala.collection.mutable.HashMap.foreach(HashMap.scala:98) at kafka.server.ReplicaManager.makeLeaders(ReplicaManager.scala:755) at kafka.server.ReplicaManager.becomeLeaderOrFollower(ReplicaManager.scala:701) at kafka.server.KafkaApis.handleLeaderAndIsrRequest(KafkaApis.scala:148) at kafka.server.KafkaApis.handle(KafkaApis.scala:84) at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:62) at java.lang.Thread.run(Thread.java:745)
However, the topic seems to be created successfully.
5. Stop the server.
6. Restart the server. This causes an exception and shuts down the server.
[2016-12-02 14:55:25,056] ERROR There was an error in one of the threads during logs loading: java.lang.NullPointerException (kafka.log.LogManager) [2016-12-02 14:55:25,057] FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer) java.lang.NullPointerException at kafka.log.Log.logEndOffset(Log.scala:719) at kafka.log.Log$$anonfun$1.apply(Log.scala:113) at kafka.log.Log$$anonfun$1.apply(Log.scala:113) at kafka.utils.Logging$class.info(Logging.scala:70) at kafka.log.Log.info(Log.scala:86) at kafka.log.Log.<init>(Log.scala:112) at kafka.log.LogManager$$anonfun$loadLogs$2$$anonfun$3$$anonfun$apply$10$$anonfun$apply$1.apply$mcV$sp(LogManager.scala:155) at kafka.utils.CoreUtils$$anon$1.run(CoreUtils.scala:58) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
Attachments
Issue Links
- links to