aiokafka icon indicating copy to clipboard operation
aiokafka copied to clipboard

If producer.start() is forgotten, the kafka will freeze in endless waiting

Open python-developer-1 opened this issue 4 years ago • 3 comments
trafficstars

Describe the bug If dev forgets to call producer.start(), the producer will gets stucked in some await on line await self.force_metadata_update() here: https://github.com/aio-libs/aiokafka/blob/master/aiokafka/client.py#L630

Expected behaviour I think there should be check and exception raise when start() was not called.

Environment (please complete the following information):

  • aiokafka version 0.7.1
  • kafka-python version 2.0.2
  • Kafka Broker version 2.1.0

Reproducible example

value = ... # kafka message

producer = AIOKafkaProducer(self._kafka_url, client_id=self._client_id)
# producer.start() # OMITTED!
batch = kafka_producer.create_batch()
batch.append(value=value.encode("utf-8"), key=None, timestamp=None)
batch.close()
await producer.send_batch(batch, kafka_topic, partition=0) # <-- stucked here

python-developer-1 avatar Jun 28 '21 11:06 python-developer-1

I'd appreciate any feedback on this question too! Thanks!

andreaturli avatar Apr 03 '23 17:04 andreaturli

I have same issue but the steps to reproduce little different: start is called but failed, behaviour is the same - send() hangs forever

kmihaltsov avatar Oct 18 '23 18:10 kmihaltsov