Describe the bug
Consumers and Producers when __aenter__() errors (such as network-related exceptions) leaves the object in a state requiring an explicit close() call.
Context manager interfaces via the "with" keyword do not invoke __aclose__() if entering failed.
Expected behaviour
__aenter__() and start() if an exception raises put the object back into an "unentered" state, and potentially allow trying again later.
Environment (please complete the following information):
- aiokafka version (
python -c "import aiokafka; print(aiokafka.__version__)"): 0.12.0
- Kafka Broker version (
kafka-topics.sh --version): 2.8.1
Reproducible example
See Fork Commit