You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Robert Zitelli <ro...@gmail.com> on 2014/03/22 01:39:05 UTC

kafka.common.LeaderNotAvailableException

All,
Please help...

I constantly get LeaderNotAvailableExceptions using the
kafka-console-producer.
I am using kafka_2.8.0-0.8.0

zookeeper and kafka-server seem to run without errors.

Here are the results from the topic list and the kafka-console-producer.
The server-change.log is below; there are not errors.


c:\kafka>.\bin\windows\kafka-list-topic.bat --zookeeper localhost:2181
topic: bob      partition: 0    leader: 0       replicas: 0     isr: 0
topic: bob      partition: 1    leader: 0       replicas: 0     isr: 0


c:\kafka>.\bin\windows\kafka-console-producer.bat --broker-list
localhost:9092 -
-topic bob
aaaaaaaaaaaaaaaaaaaaaaaa
[2014-03-21 20:17:26,093] WARN Error while fetching metadata
[{TopicMetadata for
 topic bob ->
No partition metadata for topic bob due to
kafka.common.LeaderNotAvailableExcept
ion}] for topic [bob]: class kafka.common.LeaderNotAvailableException  (
kafka.pr
oducer.BrokerPartitionInfo)
[2014-03-21 20:17:26,110] WARN Error while fetching metadata
[{TopicMetadata for
 topic bob ->
No partition metadata for topic bob due to
kafka.common.LeaderNotAvailableExcept
ion}] for topic [bob]: class kafka.common.LeaderNotAvailableException  (
kafka.pr
oducer.BrokerPartitionInfo)
[2014-03-21 20:17:26,111] ERROR Failed to collate messages by topic,
partition d
ue to: Failed to fetch topic metadata for topic: bob
(kafka.producer.async.Defau
ltEventHandler)
bbbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccc
ddddddddddddddddddd



server-change.log
[2014-03-21 20:15:27,806] DEBUG preRegister called.
Server=com.sun.jmx.mbeanserver.JmxMBeanServer@31a9dc55,
name=log4j:logger=state.change.logger (state.change.logger)
[2014-03-21 20:17:26,043] TRACE Controller 0 epoch 1 changed partition
[bob,1] state from NotExists to New with assigned replicas 0
(state.change.logger)
[2014-03-21 20:17:26,057] TRACE Controller 0 epoch 1 changed partition
[bob,0] state from NotExists to New with assigned replicas 0
(state.change.logger)
[2014-03-21 20:17:26,066] TRACE Controller 0 epoch 1 changed state of
replica 0 for partition [bob,1] to NewReplica (state.change.logger)
[2014-03-21 20:17:26,067] TRACE Controller 0 epoch 1 changed state of
replica 0 for partition [bob,0] to NewReplica (state.change.logger)
[2014-03-21 20:17:26,092] TRACE Controller 0 epoch 1 changed partition
[bob,1] from OnlinePartition to OnlinePartition with leader 0
(state.change.logger)
[2014-03-21 20:17:26,099] TRACE Controller 0 epoch 1 changed partition
[bob,0] from OnlinePartition to OnlinePartition with leader 0
(state.change.logger)
[2014-03-21 20:17:26,105] TRACE Controller 0 epoch 1 sending become-leader
LeaderAndIsr request with correlationId 6 to broker 0 for partition [bob,1]
(state.change.logger)
[2014-03-21 20:17:26,106] TRACE Controller 0 epoch 1 sending become-leader
LeaderAndIsr request with correlationId 6 to broker 0 for partition [bob,0]
(state.change.logger)
[2014-03-21 20:17:26,110] TRACE Controller 0 epoch 1 sending UpdateMetadata
request with correlationId 6 to broker 0 for partition [bob,1]
(state.change.logger)
[2014-03-21 20:17:26,110] TRACE Controller 0 epoch 1 sending UpdateMetadata
request with correlationId 6 to broker 0 for partition [bob,0]
(state.change.logger)
[2014-03-21 20:17:26,112] TRACE Controller 0 epoch 1 changed state of
replica 0 for partition [bob,1] to OnlineReplica (state.change.logger)
[2014-03-21 20:17:26,113] TRACE Controller 0 epoch 1 changed state of
replica 0 for partition [bob,0] to OnlineReplica (state.change.logger)
[2014-03-21 20:17:26,121] TRACE Broker 0 handling LeaderAndIsr request
correlation id 6 received from controller 0 epoch 1 for partition [bob,1]
(state.change.logger)
[2014-03-21 20:17:26,122] TRACE Broker 0 handling LeaderAndIsr request
correlation id 6 received from controller 0 epoch 1 for partition [bob,0]
(state.change.logger)
[2014-03-21 20:17:26,126] TRACE Broker 0 received LeaderAndIsr request
correlationId 6 from controller 0 epoch 1 starting the become-leader
transition for partition [bob,1] (state.change.logger)
[2014-03-21 20:17:26,179] TRACE Broker 0 completed become-leader transition
for partition [bob,1] (state.change.logger)
[2014-03-21 20:17:26,179] TRACE Broker 0 handled LeaderAndIsr request
correlationId 6 received from controller 0 epoch 1 for partition [bob,1]
(state.change.logger)
[2014-03-21 20:17:26,179] TRACE Broker 0 received LeaderAndIsr request
correlationId 6 from controller 0 epoch 1 starting the become-leader
transition for partition [bob,0] (state.change.logger)
[2014-03-21 20:17:26,185] TRACE Broker 0 completed become-leader transition
for partition [bob,0] (state.change.logger)
[2014-03-21 20:17:26,185] TRACE Broker 0 handled LeaderAndIsr request
correlationId 6 received from controller 0 epoch 1 for partition [bob,0]
(state.change.logger)
[2014-03-21 20:17:26,200] TRACE Controller 0 epoch 1 received response
correlationId 6 for a request sent to broker 0 (state.change.logger)
[2014-03-21 20:17:26,209] TRACE Broker 0 cached leader info
(LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:0,ControllerEpoch:1),ReplicationFactor:1),AllReplicas:0)
for partition [bob,1] in response to UpdateMetadata request sent by
controller 0 epoch 1 with correlation id 6 (state.change.logger)
[2014-03-21 20:17:26,210] TRACE Broker 0 cached leader info
(LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:0,ControllerEpoch:1),ReplicationFactor:1),AllReplicas:0)
for partition [bob,0] in response to UpdateMetadata request sent by
controller 0 epoch 1 with correlation id 6 (state.change.logger)
[2014-03-21 20:17:26,212] TRACE Controller 0 epoch 1 received response
correlationId 6 for a request sent to broker 0 (state.change.logger)


-- 
Bob Zitelli
201-390-8537
robert.zitelli@gmail.com

Re: kafka.common.LeaderNotAvailableException

Posted by Guozhang Wang <wa...@gmail.com>.
BTW I think it is better if we can make such logging entries as WARN for
the first few times, since they are not really ERRORs.

Guozhang


On Sun, Mar 23, 2014 at 10:33 AM, Guozhang Wang <wa...@gmail.com> wrote:

> Hi Robert,
>
> This error is expected on the first few messages sending with a new topic,
> since the broker needs some time to create the topic and propagate the
> metadata. Please try keep sending and see if this exception goes away. If
> it is not transient, please let us know.
>
> Guozhang
>
>
> On Fri, Mar 21, 2014 at 5:39 PM, Robert Zitelli <ro...@gmail.com>wrote:
>
>> All,
>> Please help...
>>
>> I constantly get LeaderNotAvailableExceptions using the
>> kafka-console-producer.
>> I am using kafka_2.8.0-0.8.0
>>
>> zookeeper and kafka-server seem to run without errors.
>>
>> Here are the results from the topic list and the kafka-console-producer.
>> The server-change.log is below; there are not errors.
>>
>>
>> c:\kafka>.\bin\windows\kafka-list-topic.bat --zookeeper localhost:2181
>> topic: bob      partition: 0    leader: 0       replicas: 0     isr: 0
>> topic: bob      partition: 1    leader: 0       replicas: 0     isr: 0
>>
>>
>> c:\kafka>.\bin\windows\kafka-console-producer.bat --broker-list
>> localhost:9092 -
>> -topic bob
>> aaaaaaaaaaaaaaaaaaaaaaaa
>> [2014-03-21 20:17:26,093] WARN Error while fetching metadata
>> [{TopicMetadata for
>>  topic bob ->
>> No partition metadata for topic bob due to
>> kafka.common.LeaderNotAvailableExcept
>> ion}] for topic [bob]: class kafka.common.LeaderNotAvailableException  (
>> kafka.pr
>> oducer.BrokerPartitionInfo)
>> [2014-03-21 20:17:26,110] WARN Error while fetching metadata
>> [{TopicMetadata for
>>  topic bob ->
>> No partition metadata for topic bob due to
>> kafka.common.LeaderNotAvailableExcept
>> ion}] for topic [bob]: class kafka.common.LeaderNotAvailableException  (
>> kafka.pr
>> oducer.BrokerPartitionInfo)
>> [2014-03-21 20:17:26,111] ERROR Failed to collate messages by topic,
>> partition d
>> ue to: Failed to fetch topic metadata for topic: bob
>> (kafka.producer.async.Defau
>> ltEventHandler)
>> bbbbbbbbbbbbbbbbbbbbb
>> cccccccccccccccccccc
>> ddddddddddddddddddd
>>
>>
>>
>> server-change.log
>> [2014-03-21 20:15:27,806] DEBUG preRegister called.
>> Server=com.sun.jmx.mbeanserver.JmxMBeanServer@31a9dc55,
>> name=log4j:logger=state.change.logger (state.change.logger)
>> [2014-03-21 20:17:26,043] TRACE Controller 0 epoch 1 changed partition
>> [bob,1] state from NotExists to New with assigned replicas 0
>> (state.change.logger)
>> [2014-03-21 20:17:26,057] TRACE Controller 0 epoch 1 changed partition
>> [bob,0] state from NotExists to New with assigned replicas 0
>> (state.change.logger)
>> [2014-03-21 20:17:26,066] TRACE Controller 0 epoch 1 changed state of
>> replica 0 for partition [bob,1] to NewReplica (state.change.logger)
>> [2014-03-21 20:17:26,067] TRACE Controller 0 epoch 1 changed state of
>> replica 0 for partition [bob,0] to NewReplica (state.change.logger)
>> [2014-03-21 20:17:26,092] TRACE Controller 0 epoch 1 changed partition
>> [bob,1] from OnlinePartition to OnlinePartition with leader 0
>> (state.change.logger)
>> [2014-03-21 20:17:26,099] TRACE Controller 0 epoch 1 changed partition
>> [bob,0] from OnlinePartition to OnlinePartition with leader 0
>> (state.change.logger)
>> [2014-03-21 20:17:26,105] TRACE Controller 0 epoch 1 sending become-leader
>> LeaderAndIsr request with correlationId 6 to broker 0 for partition
>> [bob,1]
>> (state.change.logger)
>> [2014-03-21 20:17:26,106] TRACE Controller 0 epoch 1 sending become-leader
>> LeaderAndIsr request with correlationId 6 to broker 0 for partition
>> [bob,0]
>> (state.change.logger)
>> [2014-03-21 20:17:26,110] TRACE Controller 0 epoch 1 sending
>> UpdateMetadata
>> request with correlationId 6 to broker 0 for partition [bob,1]
>> (state.change.logger)
>> [2014-03-21 20:17:26,110] TRACE Controller 0 epoch 1 sending
>> UpdateMetadata
>> request with correlationId 6 to broker 0 for partition [bob,0]
>> (state.change.logger)
>> [2014-03-21 20:17:26,112] TRACE Controller 0 epoch 1 changed state of
>> replica 0 for partition [bob,1] to OnlineReplica (state.change.logger)
>> [2014-03-21 20:17:26,113] TRACE Controller 0 epoch 1 changed state of
>> replica 0 for partition [bob,0] to OnlineReplica (state.change.logger)
>> [2014-03-21 20:17:26,121] TRACE Broker 0 handling LeaderAndIsr request
>> correlation id 6 received from controller 0 epoch 1 for partition [bob,1]
>> (state.change.logger)
>> [2014-03-21 20:17:26,122] TRACE Broker 0 handling LeaderAndIsr request
>> correlation id 6 received from controller 0 epoch 1 for partition [bob,0]
>> (state.change.logger)
>> [2014-03-21 20:17:26,126] TRACE Broker 0 received LeaderAndIsr request
>> correlationId 6 from controller 0 epoch 1 starting the become-leader
>> transition for partition [bob,1] (state.change.logger)
>> [2014-03-21 20:17:26,179] TRACE Broker 0 completed become-leader
>> transition
>> for partition [bob,1] (state.change.logger)
>> [2014-03-21 20:17:26,179] TRACE Broker 0 handled LeaderAndIsr request
>> correlationId 6 received from controller 0 epoch 1 for partition [bob,1]
>> (state.change.logger)
>> [2014-03-21 20:17:26,179] TRACE Broker 0 received LeaderAndIsr request
>> correlationId 6 from controller 0 epoch 1 starting the become-leader
>> transition for partition [bob,0] (state.change.logger)
>> [2014-03-21 20:17:26,185] TRACE Broker 0 completed become-leader
>> transition
>> for partition [bob,0] (state.change.logger)
>> [2014-03-21 20:17:26,185] TRACE Broker 0 handled LeaderAndIsr request
>> correlationId 6 received from controller 0 epoch 1 for partition [bob,0]
>> (state.change.logger)
>> [2014-03-21 20:17:26,200] TRACE Controller 0 epoch 1 received response
>> correlationId 6 for a request sent to broker 0 (state.change.logger)
>> [2014-03-21 20:17:26,209] TRACE Broker 0 cached leader info
>>
>> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:0,ControllerEpoch:1),ReplicationFactor:1),AllReplicas:0)
>> for partition [bob,1] in response to UpdateMetadata request sent by
>> controller 0 epoch 1 with correlation id 6 (state.change.logger)
>> [2014-03-21 20:17:26,210] TRACE Broker 0 cached leader info
>>
>> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:0,ControllerEpoch:1),ReplicationFactor:1),AllReplicas:0)
>> for partition [bob,0] in response to UpdateMetadata request sent by
>> controller 0 epoch 1 with correlation id 6 (state.change.logger)
>> [2014-03-21 20:17:26,212] TRACE Controller 0 epoch 1 received response
>> correlationId 6 for a request sent to broker 0 (state.change.logger)
>>
>>
>> --
>> Bob Zitelli
>> 201-390-8537
>> robert.zitelli@gmail.com
>>
>
>
>
> --
> -- Guozhang
>



-- 
-- Guozhang

Re: kafka.common.LeaderNotAvailableException

Posted by Guozhang Wang <wa...@gmail.com>.
Hi Robert,

This error is expected on the first few messages sending with a new topic,
since the broker needs some time to create the topic and propagate the
metadata. Please try keep sending and see if this exception goes away. If
it is not transient, please let us know.

Guozhang


On Fri, Mar 21, 2014 at 5:39 PM, Robert Zitelli <ro...@gmail.com>wrote:

> All,
> Please help...
>
> I constantly get LeaderNotAvailableExceptions using the
> kafka-console-producer.
> I am using kafka_2.8.0-0.8.0
>
> zookeeper and kafka-server seem to run without errors.
>
> Here are the results from the topic list and the kafka-console-producer.
> The server-change.log is below; there are not errors.
>
>
> c:\kafka>.\bin\windows\kafka-list-topic.bat --zookeeper localhost:2181
> topic: bob      partition: 0    leader: 0       replicas: 0     isr: 0
> topic: bob      partition: 1    leader: 0       replicas: 0     isr: 0
>
>
> c:\kafka>.\bin\windows\kafka-console-producer.bat --broker-list
> localhost:9092 -
> -topic bob
> aaaaaaaaaaaaaaaaaaaaaaaa
> [2014-03-21 20:17:26,093] WARN Error while fetching metadata
> [{TopicMetadata for
>  topic bob ->
> No partition metadata for topic bob due to
> kafka.common.LeaderNotAvailableExcept
> ion}] for topic [bob]: class kafka.common.LeaderNotAvailableException  (
> kafka.pr
> oducer.BrokerPartitionInfo)
> [2014-03-21 20:17:26,110] WARN Error while fetching metadata
> [{TopicMetadata for
>  topic bob ->
> No partition metadata for topic bob due to
> kafka.common.LeaderNotAvailableExcept
> ion}] for topic [bob]: class kafka.common.LeaderNotAvailableException  (
> kafka.pr
> oducer.BrokerPartitionInfo)
> [2014-03-21 20:17:26,111] ERROR Failed to collate messages by topic,
> partition d
> ue to: Failed to fetch topic metadata for topic: bob
> (kafka.producer.async.Defau
> ltEventHandler)
> bbbbbbbbbbbbbbbbbbbbb
> cccccccccccccccccccc
> ddddddddddddddddddd
>
>
>
> server-change.log
> [2014-03-21 20:15:27,806] DEBUG preRegister called.
> Server=com.sun.jmx.mbeanserver.JmxMBeanServer@31a9dc55,
> name=log4j:logger=state.change.logger (state.change.logger)
> [2014-03-21 20:17:26,043] TRACE Controller 0 epoch 1 changed partition
> [bob,1] state from NotExists to New with assigned replicas 0
> (state.change.logger)
> [2014-03-21 20:17:26,057] TRACE Controller 0 epoch 1 changed partition
> [bob,0] state from NotExists to New with assigned replicas 0
> (state.change.logger)
> [2014-03-21 20:17:26,066] TRACE Controller 0 epoch 1 changed state of
> replica 0 for partition [bob,1] to NewReplica (state.change.logger)
> [2014-03-21 20:17:26,067] TRACE Controller 0 epoch 1 changed state of
> replica 0 for partition [bob,0] to NewReplica (state.change.logger)
> [2014-03-21 20:17:26,092] TRACE Controller 0 epoch 1 changed partition
> [bob,1] from OnlinePartition to OnlinePartition with leader 0
> (state.change.logger)
> [2014-03-21 20:17:26,099] TRACE Controller 0 epoch 1 changed partition
> [bob,0] from OnlinePartition to OnlinePartition with leader 0
> (state.change.logger)
> [2014-03-21 20:17:26,105] TRACE Controller 0 epoch 1 sending become-leader
> LeaderAndIsr request with correlationId 6 to broker 0 for partition [bob,1]
> (state.change.logger)
> [2014-03-21 20:17:26,106] TRACE Controller 0 epoch 1 sending become-leader
> LeaderAndIsr request with correlationId 6 to broker 0 for partition [bob,0]
> (state.change.logger)
> [2014-03-21 20:17:26,110] TRACE Controller 0 epoch 1 sending UpdateMetadata
> request with correlationId 6 to broker 0 for partition [bob,1]
> (state.change.logger)
> [2014-03-21 20:17:26,110] TRACE Controller 0 epoch 1 sending UpdateMetadata
> request with correlationId 6 to broker 0 for partition [bob,0]
> (state.change.logger)
> [2014-03-21 20:17:26,112] TRACE Controller 0 epoch 1 changed state of
> replica 0 for partition [bob,1] to OnlineReplica (state.change.logger)
> [2014-03-21 20:17:26,113] TRACE Controller 0 epoch 1 changed state of
> replica 0 for partition [bob,0] to OnlineReplica (state.change.logger)
> [2014-03-21 20:17:26,121] TRACE Broker 0 handling LeaderAndIsr request
> correlation id 6 received from controller 0 epoch 1 for partition [bob,1]
> (state.change.logger)
> [2014-03-21 20:17:26,122] TRACE Broker 0 handling LeaderAndIsr request
> correlation id 6 received from controller 0 epoch 1 for partition [bob,0]
> (state.change.logger)
> [2014-03-21 20:17:26,126] TRACE Broker 0 received LeaderAndIsr request
> correlationId 6 from controller 0 epoch 1 starting the become-leader
> transition for partition [bob,1] (state.change.logger)
> [2014-03-21 20:17:26,179] TRACE Broker 0 completed become-leader transition
> for partition [bob,1] (state.change.logger)
> [2014-03-21 20:17:26,179] TRACE Broker 0 handled LeaderAndIsr request
> correlationId 6 received from controller 0 epoch 1 for partition [bob,1]
> (state.change.logger)
> [2014-03-21 20:17:26,179] TRACE Broker 0 received LeaderAndIsr request
> correlationId 6 from controller 0 epoch 1 starting the become-leader
> transition for partition [bob,0] (state.change.logger)
> [2014-03-21 20:17:26,185] TRACE Broker 0 completed become-leader transition
> for partition [bob,0] (state.change.logger)
> [2014-03-21 20:17:26,185] TRACE Broker 0 handled LeaderAndIsr request
> correlationId 6 received from controller 0 epoch 1 for partition [bob,0]
> (state.change.logger)
> [2014-03-21 20:17:26,200] TRACE Controller 0 epoch 1 received response
> correlationId 6 for a request sent to broker 0 (state.change.logger)
> [2014-03-21 20:17:26,209] TRACE Broker 0 cached leader info
>
> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:0,ControllerEpoch:1),ReplicationFactor:1),AllReplicas:0)
> for partition [bob,1] in response to UpdateMetadata request sent by
> controller 0 epoch 1 with correlation id 6 (state.change.logger)
> [2014-03-21 20:17:26,210] TRACE Broker 0 cached leader info
>
> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:0,ControllerEpoch:1),ReplicationFactor:1),AllReplicas:0)
> for partition [bob,0] in response to UpdateMetadata request sent by
> controller 0 epoch 1 with correlation id 6 (state.change.logger)
> [2014-03-21 20:17:26,212] TRACE Controller 0 epoch 1 received response
> correlationId 6 for a request sent to broker 0 (state.change.logger)
>
>
> --
> Bob Zitelli
> 201-390-8537
> robert.zitelli@gmail.com
>



-- 
-- Guozhang