Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cluster communiction problems in 1.4.5 & 1.4.6 #1856

Closed
ov7a opened this issue Jul 1, 2019 · 2 comments
Closed

Cluster communiction problems in 1.4.5 & 1.4.6 #1856

ov7a opened this issue Jul 1, 2019 · 2 comments

Comments

@ov7a
Copy link

ov7a commented Jul 1, 2019

Sample code:

from kafka import KafkaConsumer
kafka_client = KafkaConsumer(bootstrap_servers = "node1:9093")
topic = "some topic"
partitions = kafka_client.partitions_for_topic(topic)
print(partitions)
kafka_client.close()	

I get {0, 1, 2, 3, 4, 5, 6, 7} in 1.4.4 and earlier versions, and None in 1.4.5 and 1.4.6.

Kafka version: 2.2.0

@zahidzaman
Copy link

Had same issue but got resolved when called kafka_client.topics() before kafka_client.partitions_for_topic(topic). I think follwing is the reason for failure https://kafka-python.readthedocs.io/en/master/apidoc/KafkaConsumer.html

This method first checks the local metadata cache for information about the topic. If the topic is not found (either because the topic does not exist, the user is not authorized to view the topic, or the metadata cache is not populated), then it will issue a metadata update call to the cluster.

@jeffwidman
Copy link
Collaborator

jeffwidman commented Jul 11, 2019

Dupe of #1774. This has already been fixed on master in #1781... but not yet in a public release.

essentially some changes in 1.4.5 meant that the call would return None if the metadata hadn't yet been force fetched through another method, so we changed it to issue a call...

Hopefully we can get a release out in the next few weeks with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants