Skip to content

Consumer blocks indefinitely in poll when assigned partitions and brokers are unavailable #1764

Closed
@nihb

Description

@nihb

Firstly: thanks (!) for writing this library.
I'm not sure if this is user error, a bug or a feature, but the following blocks indefinitely on the poll() command (no broker needed) in python2 and python3 on 1.3.5, 1.4.3, 1.4.5 as well as on 1.4.6.dev:

from kafka import KafkaConsumer, TopicPartition
# N.B. "yyy" does not resolve to any hostname on my network
consumer = KafkaConsumer(bootstrap_servers='yyy:9092', api_version='0.10.1')
consumer.assign([TopicPartition('zzz', 0)])
r_poll = consumer.poll(timeout_ms=1000)

I've also tested it by replacing "yyy" above with local hosts whose dns entries are defined but which have been turned off with the same results (blocks indefinitely). Adding group_id to KafkaConsumer also doesn't seem to help.

P.S. Removing the api_version='0.10.1' allows the KafkaConsumer() call to return immediately with no brokers available in 1.4.6.dev, blocks indefinitely on KafkaConsumer() in 1.4.5, returns immediately in 1.3.5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions