aiokafka
aiokafka copied to clipboard
If producer.start() is forgotten, the kafka will freeze in endless waiting
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
I'd appreciate any feedback on this question too! Thanks!
I have same issue but the steps to reproduce little different: start is called but failed, behaviour is the same - send() hangs forever