Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many reqs on kafka not available #496

Closed
lud4ik opened this issue Apr 11, 2019 · 6 comments
Closed

Too many reqs on kafka not available #496

lud4ik opened this issue Apr 11, 2019 · 6 comments
Milestone

Comments

@lud4ik
Copy link

lud4ik commented Apr 11, 2019

I have code with simple consumer. I undestand that most of time at least 1 of nodes will be available. But on kafka stop it send too many requests and uses up to 100% cpu

2019-04-11 12:06:55,732 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,732 Unable to update metadata from [0]
2019-04-11 12:06:55,732 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,732 Failed fetch messages from 0: NodeNotReadyError: Attempt to send a request to node which is not ready (node id 0).
1
2019-04-11 12:06:55,733 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,733 Unable to update metadata from [0]
2019-04-11 12:06:55,734 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,734 Failed fetch messages from 0: NodeNotReadyError: Attempt to send a request to node which is not ready (node id 0).
1
2019-04-11 12:06:55,734 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,734 Unable to update metadata from [0]
2019-04-11 12:06:55,735 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,735 Failed fetch messages from 0: NodeNotReadyError: Attempt to send a request to node which is not ready (node id 0).
1
2019-04-11 12:06:55,736 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,736 Unable to update metadata from [0]
2019-04-11 12:06:55,736 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,736 Failed fetch messages from 0: NodeNotReadyError: Attempt to send a request to node which is not ready (node id 0).
1
2019-04-11 12:06:55,737 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,737 Unable to update metadata from [0]
2019-04-11 12:06:55,737 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,737 Failed fetch messages from 0: NodeNotReadyError: Attempt to send a request to node which is not ready (node id 0).
1
2019-04-11 12:06:55,738 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,738 Unable to update metadata from [0]
2019-04-11 12:06:55,738 Unable connect to node with id 0: [Errno 111] Connect call failed ('10.0.3.2', 9092)
2019-04-11 12:06:55,738 Failed fetch messages from 0: NodeNotReadyError: Attempt to send a request to node which is not ready (node id 0).

Isn't retry_backoff_ms param meant for this case? Is it used on production systems?

@tvoinarovskyi
Copy link
Member

Hmm, seems like a bug. Will try to ckeck once I get back from pto. The case definitely deserves an integration test.

@nikitagashkov
Copy link

I'm facing the same issue using Docker and Docker Compose.

There're two containers, namely python and kafka. If kafka container dies, python container endlessly tries to connect. A relevant code snippet from a python container:

import aiokafka
import asyncio


async def main():
    
    producer = aiokafka.AIOKafkaProducer(
        loop=asyncio.get_event_loop(),
        bootstrap_servers='kafka:9092',
    )
    
    await producer.start()
    
    try:
        while True:
            await asyncio.sleep(1)
            await producer.send('test', b'test-data')
    finally:
        await producer.stop()


if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

After killing kafka...

$ docker-compose stop kafka

...endless reconnect loop occures in a python container:

ERROR:aiokafka:Unable connect to node with id 1001: [Errno 111] Connect call failed ('172.28.0.3', 9092)
ERROR:aiokafka:Unable to update metadata from [1001]
ERROR:aiokafka:Unable connect to node with id 1001: [Errno 111] Connect call failed ('172.28.0.3', 9092)
WARNING:aiokafka.producer.sender:Got error produce response: NodeNotReadyError: Attempt to send a request to node which is not ready (node id 1001).
ERROR:aiokafka:Unable connect to node with id 1001: [Errno 111] Connect call failed ('172.28.0.3', 9092)
ERROR:aiokafka:Unable to update metadata from [1001]
ERROR:aiokafka:Unable connect to node with id 1001: [Errno 111] Connect call failed ('172.28.0.3', 9092)
WARNING:aiokafka.producer.sender:Got error produce response: NodeNotReadyError: Attempt to send a request to node which is not ready (node id 1001).
ERROR:aiokafka:Unable connect to node with id 1001: [Errno 111] Connect call failed ('172.28.0.3', 9092)
ERROR:aiokafka:Unable to update metadata from [1001]
ERROR:aiokafka:Unable connect to node with id 1001: [Errno 111] Connect call failed ('172.28.0.3', 9092)
WARNING:aiokafka.producer.sender:Got error produce response: NodeNotReadyError: Attempt to send a request to node which is not ready (node id 1001).
ERROR:aiokafka:Unable connect to node with id 1001: [Errno 111] Connect call failed ('172.28.0.3', 9092)

@tvoinarovskyi
Copy link
Member

Will try to find time for this on 0.6.0, as it's a bad one. We can't have logs filling like crazy.

@arvindjangra1996
Copy link

arvindjangra1996 commented May 13, 2020

hey, can we catch "NodeNotReadyError" exception while consuming from Kafka. So that we can take any action at this situation. Like sending alert.

@tvoinarovskyi
Copy link
Member

@arvindjangra1996 Will answer in #612

@tvoinarovskyi
Copy link
Member

Merge and released as part of 0.6.0. Hope it solves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants