aio-libs / aiokafka

asyncio client for kafka
http://aiokafka.readthedocs.io/
Apache License 2.0
1.08k stars 224 forks source link

Connection errors are spamming #1020

Open legau opened 5 days ago

legau commented 5 days ago

Describe the bug Whenever AIOKafkaConsumer (maybe Producer too) loses connection to Kafka, 17 identical error logs are outputted.

Failed fetch messages from 1: NodeNotReadyError: Attempt to send a request to node which is not ready (node id 1).
Unable connect to node with id 1: [Errno 111] Connect call failed ('172.19.0.8', 29092)
Unable to update metadata from [1]

Expected behaviour Only 1 log

Environment (please complete the following information):

Reproducible example

from aiokafka import AIOKafkaConsumer

async def run_consumer():
    async with AIOKafkaConsumer(
        "test",
        bootstrap_servers="kafka:29092",
    ) as consumer:
        async for message in consumer:
            print(message.value)

if __name__ == "__main__":
    import asyncio

    loop = asyncio.get_event_loop()
    loop.run_until_complete(run_consumer())
    loop.close()
Ben621 commented 1 day ago

@legau Try to set api_version = "2.8.1"

e.g.



    async with AIOKafkaConsumer(
        "test",
        api_version= "2.8.1",
        bootstrap_servers="kafka:29092",
    )