ches / docker-kafka

Apache Kafka on Docker
https://hub.docker.com/r/ches/kafka/
146 stars 137 forks source link

kafka.common.UnknownException after topic creation #8

Open brnrc opened 9 years ago

brnrc commented 9 years ago

Hi ches, I'm trying to run this docker image with a remote zookeeper, this is my config:

docker run \
--name kafka \
--publish 9092:9092 \
--env KAFKA_BROKER_ID=$RANDOM \
--env KAFKA_ADVERTISED_HOST_NAME=`ifconfig eth0 2>/dev/null|awk '/inet addr:/ {print $2}'|sed 's/addr://'` \
--env KAFKA_ADVERTISED_PORT=9092 \
--env ZOOKEEPER_CONNECTION_STRING=<remote_url:port> \
ches/kafka

After creating a topic with ./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 2 --partitions 3 --topic omg_3 my container crashes but not before printing for 5min the same exception:

[2015-10-07 21:34:07,171] ERROR [ReplicaFetcherThread-0-1529219145], Error for partition [omg_3,2] to broker 1529219145:class kafka.common.UnknownException (kafka.server.ReplicaFetcherThread)
[2015-10-07 21:34:07,171] WARN [Replica Manager on Broker 17975]: Fetch request with correlation id 275644 from client ReplicaFetcherThread-0-1529219145 on partition [omg_3,2] failed due to Leader not local for partition [omg_3,2] on broker 17975 (kafka.server.ReplicaManager)
[2015-10-07 21:34:07,171] ERROR [KafkaApi-17975] error when handling request Name: FetchRequest; Version: 0; CorrelationId: 275644; ClientId: ReplicaFetcherThread-0-1529219145; ReplicaId: 17975; MaxWait: 500 ms; MinBytes: 1 bytes; RequestInfo: [omg_3,2] -> PartitionFetchInfo(0,1048576) (kafka.server.KafkaApis)
kafka.common.KafkaException: Should not set log end offset on partition [omg_3,2]'s local replica 17975
    at kafka.cluster.Replica.logEndOffset_$eq(Replica.scala:52)
    at kafka.server.ReplicaManager.updateReplicaLEOAndPartitionHW(ReplicaManager.scala:569)
    at kafka.server.KafkaApis$$anonfun$recordFollowerLogEndOffsets$2.apply(KafkaApis.scala:388)
    at kafka.server.KafkaApis$$anonfun$recordFollowerLogEndOffsets$2.apply(KafkaApis.scala:386)
    at scala.collection.MapLike$MappedValues$$anonfun$foreach$3.apply(MapLike.scala:245)
    at scala.collection.MapLike$MappedValues$$anonfun$foreach$3.apply(MapLike.scala:245)
    at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
    at scala.collection.immutable.Map$Map1.foreach(Map.scala:109)
    at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
    at scala.collection.MapLike$MappedValues.foreach(MapLike.scala:245)
    at kafka.server.KafkaApis.recordFollowerLogEndOffsets(KafkaApis.scala:386)
    at kafka.server.KafkaApis.handleFetchRequest(KafkaApis.scala:351)
    at kafka.server.KafkaApis.handle(KafkaApis.scala:60)
    at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:59)
    at java.lang.Thread.run(Thread.java:745)

Any idea on what this exception could be?

Thanks in advance :)

ches commented 9 years ago

Are you running multiple brokers? In that case, this is a FAQ :smile: You should be forgiven being that this error message is awfully poor…

If not, perhaps there's stale data left around in Zookeeper from an unclean shutdown? You can inspect with zkCli, the link in the FAQ entry will point you to the path to look for.