aio-libs / aio-libs/aiokafka

Connection should be close if there is a failure during start

Offen
#715 4 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
1.4k
Forks
269
Ø Merge
1 T. 1 Std.
Gemergte PRs (30 T.)
6

Beschreibung

**Describe the bug**

After calling `await consumer.start()`, `AioKafkaConnection.__del__` calls `self._loop.call_exception_handler` after failing to connect to a Kafka node. If there is a failure during startup, but after the client is "connected", aiokafka should close or cleanup the connection properly without warning about an unclosed connection and calling the loop exception handler. For example, if there was a failure during version_lookup I believe AIOKafkaConnection would be "connected", but the user code does not have a chance to close the connection.

```
Unable connect to node with id 2:
Unclosed AIOKafkaConnection
conn:
Exception ignored in:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/aiokafka/conn.py", line 202, in __del__
self._loop.call_exception_handler(context)
File "/usr/lib/python3.8/asyncio/base_events.py", line 1744, in call_exception_handler
self._exception_handler(self, context)
File "/usr/local/lib/python3.8/dist-packages/featuremine/system/select_events.py", line 162, in exception_handler
raise SystemExit("Exception occured.")
SystemExit: Exception occured.
```

**Environment (please complete the following information):**
aiokafka 0.7.0
kafka-python 2.0.2

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.