Created
February 13, 2014 05:57
-
-
Save wizzat/8970493 to your computer and use it in GitHub Desktop.
Permanently break kafka topics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Null messages in Kafka permanently break a Kafka topic | |
# Reproduction Requirements: | |
# Install kafka-python (master is building towards 0.9, so use the kafka-0.8.0-release branch) | |
# Run a 3 node local kafka cluster (it may break with other sizes, but it is untested) | |
# Run a kafka SimpleConsumer (kafka-console-consumer works fine): | |
# kafka_2.8.0-0.8.0/bin/kafka-console-consumer.sh kafka-console-consumer.sh --topic some_topic --zookeeper localhost:2181 --from-beginning | |
# Run this: | |
import kafka | |
conn = kafka.client.KafkaClient('localhost', 9092) | |
topic = kafka.producer.SimpleProducer(conn, 'some_topic') | |
topic.send_messages(None) | |
# See this error from the Kafka consumer: | |
# [2014-02-12 21:31:53,504] ERROR Error processing message, stopping consumer: (kafka.consumer.ConsoleConsumer$) | |
# java.lang.NullPointerException | |
# at kafka.utils.Utils$.readBytes(Utils.scala:142) | |
# at kafka.consumer.ConsumerIterator.makeNext(ConsumerIterator.scala:106) | |
# at kafka.consumer.ConsumerIterator.makeNext(ConsumerIterator.scala:33) | |
# at kafka.utils.IteratorTemplate.maybeComputeNext(IteratorTemplate.scala:61) | |
# at kafka.utils.IteratorTemplate.hasNext(IteratorTemplate.scala:53) | |
# at scala.collection.Iterator$class.foreach(Iterator.scala:631) | |
# at kafka.utils.IteratorTemplate.foreach(IteratorTemplate.scala:32) | |
# at scala.collection.IterableLike$class.foreach(IterableLike.scala:79) | |
# at kafka.consumer.KafkaStream.foreach(KafkaStream.scala:25) | |
# at kafka.consumer.ConsoleConsumer$.main(ConsoleConsumer.scala:202) | |
# at kafka.consumer.ConsoleConsumer.main(ConsoleConsumer.scala) | |
# Consumed 0 messages | |
# All future attempts to read from this topic will fail with a NullPointerException. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment