kafka.common.KafkaTimeoutError: ('Failed to update metadata after %s secs.', 60.0)

See original GitHub issue

kafka version: 0.8.2.0-1.kafka1.3.2.p0.15 (cloudera released)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/archimonde/lib/python2.6/site-packages/kafka/producer/kafka.py", line 357, in send
    self._wait_on_metadata(topic, self.config['max_block_ms'] / 1000.0)
  File "/opt/archimonde/lib/python2.6/site-packages/kafka/producer/kafka.py", line 465, in _wait_on_metadata
    "Failed to update metadata after %s secs.", max_wait)
kafka.common.KafkaTimeoutError: ('Failed to update metadata after %s secs.', 60.0)

But it’s ok on 2.0.0-1.kafka2.0.0.p0.12.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:50 (3 by maintainers)

github_iconTop GitHub Comments

32reactions
nicholasserracommented, Jan 25, 2017

Also wondering fix. I see this error when running kafka via Docker but not when installing from binary.

EDIT: So wondering what the root cause may be to help me pinpoint issues between environments.

16reactions
griff122commented, Feb 13, 2018

Another cause for this issue is using a bytes object as the topic name, instead of a string. In python 3, you could have a string come in as a bytes object (a = b'test_string'). If this happens, you can just convert the topic name to a utf-8 string, and it might start working. It worked for me.

if type(kafka_topic) == bytes:
    kafka_topic = kafka_topic.decode('utf-8')
kafka_producer = KafkaProducer(bootstrap_servers=kafka_brokers)
kafka_producer.send(kafka_topic, payload)
kafka_producer.flush()
Read more comments on GitHub >

github_iconTop Results From Across the Web

KafkaTimeoutError: Failed to update metadata after 60.0 secs
My topic has 3 partitions. Methods works correctly sometimes and fails with error "KafkaTimeoutError: Failed to update metadata after 60.0 secs.
Read more >
KafkaTimeoutError: Failed to update metadata after 60.0 secs.
Hi guys, I'm data science student and i'm trying to use kafka (producer and consumer) download and handle tweets from twitter.
Read more >
Failed To Update Metadata After 60.0 Secs With Kafkapython
Re: Kafka producer fails to update metadata Hi @Phaneendra S that error message most usually means you have incorrectly configured your Producer and...
Read more >
KafkaTimeoutError: Failed to update metadata after 60.0 secs ...
ERROR - Exception: KafkaTimeoutError: Failed to update metadata after 60.0 secs. Status: Assignee: Priority: Resolution: Open. Unassigned. Major. Unresolved.
Read more >
org.apache.kafka.common.errors.TimeoutException: Failed to ...
... kafkaTaskFuture.get() threw ExecutionException: org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found