Closed
Description
Hi, since kafka-python 2.1.* we are receiving the following error when polling for messages: Fetch to node 4 failed: NodeNotReadyError: 4
In version 2.0.6 and before this error doesn't occur.
Since the message is logged at level error it looks like something is not ok, but we are not sure what exactly? Are we missing some basic configuration? Our KafkaConsumer has the following configuration (security config removed):
return KafkaConsumer(bootstrap_servers=bootstrap_servers,
group_id=group_id,
auto_offset_reset="earliest",
enable_auto_commit=False,
value_deserializer=lambda m: m.decode("utf-8"),
fetch_min_bytes=100_000_000,
max_partition_fetch_bytes=100_000_000,
max_poll_records=max_poll_records, # 8_000
max_poll_interval_ms=max_poll_interval_ms # 300_000
In the end, the messages do get polled and everything works as it should, except that we have the error logs in our monitoring.
What we tried:
- Set the
api_version
config parameter to 2.6 (value that is autodetected if nothing is set) -> no change - Downgrade kafka-python to 2.0.6 -> no more errors
I increased the log level and copied the preceding log lines (ip addresses removed, if more are needed please tell me):
timestamp=2025-05-01T13:12:47.906 thread=24384 loglevel=DEBUG module=conn appname=mdmamn-eap-anlagenobjekte message="<BrokerConnection client_id=kafka-python-2.2.2, node_id=coordinator-5 host=... <connected> [IPv4 ('...', ...)]>: Response 7 (20.273447036743164 ms): OffsetFetchResponse_v5(throttle_time_ms=0, topics=[(topic='mdmamn.test.v2.infrastrukturobjekt.json', partitions=[(partition=5, offset=6045066, leader_epoch=-1, metadata='', error_code=0), (partition=4, offset=3401161, leader_epoch=-1, metadata='', error_code=0), (partition=2, offset=4246715, leader_epoch=-1, metadata='', error_code=0), (partition=1, offset=2790365, leader_epoch=-1, metadata='', error_code=0), (partition=3, offset=2849945, leader_epoch=-1, metadata='', error_code=0), (partition=0, offset=7121325, leader_epoch=-1, metadata='', error_code=0)])], error_code=0)"
timestamp=2025-05-01T13:12:47.907 thread=24384 loglevel=DEBUG module=consumer appname=mdmamn-eap-anlagenobjekte message="Setting offset for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=5) to the committed offset 6045066"
timestamp=2025-05-01T13:12:47.907 thread=24384 loglevel=DEBUG module=consumer appname=mdmamn-eap-anlagenobjekte message="Setting offset for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=4) to the committed offset 3401161"
timestamp=2025-05-01T13:12:47.907 thread=24384 loglevel=DEBUG module=consumer appname=mdmamn-eap-anlagenobjekte message="Setting offset for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=2) to the committed offset 4246715"
timestamp=2025-05-01T13:12:47.907 thread=24384 loglevel=DEBUG module=consumer appname=mdmamn-eap-anlagenobjekte message="Setting offset for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=1) to the committed offset 2790365"
timestamp=2025-05-01T13:12:47.907 thread=24384 loglevel=DEBUG module=consumer appname=mdmamn-eap-anlagenobjekte message="Setting offset for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=3) to the committed offset 2849945"
timestamp=2025-05-01T13:12:47.907 thread=24384 loglevel=DEBUG module=consumer appname=mdmamn-eap-anlagenobjekte message="Setting offset for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=0) to the committed offset 7121325"
timestamp=2025-05-01T13:12:47.907 thread=24384 loglevel=DEBUG module=fetcher appname=mdmamn-eap-anlagenobjekte message="Adding fetch request for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=0) at offset 7121325"
timestamp=2025-05-01T13:12:47.908 thread=24384 loglevel=DEBUG module=fetcher appname=mdmamn-eap-anlagenobjekte message="Adding fetch request for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=1) at offset 2790365"
timestamp=2025-05-01T13:12:47.908 thread=24384 loglevel=DEBUG module=fetcher appname=mdmamn-eap-anlagenobjekte message="Adding fetch request for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=2) at offset 4246715"
timestamp=2025-05-01T13:12:47.908 thread=24384 loglevel=DEBUG module=fetcher appname=mdmamn-eap-anlagenobjekte message="Adding fetch request for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=3) at offset 2849945"
timestamp=2025-05-01T13:12:47.908 thread=24384 loglevel=DEBUG module=fetcher appname=mdmamn-eap-anlagenobjekte message="Adding fetch request for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=4) at offset 3401161"
timestamp=2025-05-01T13:12:47.908 thread=24384 loglevel=DEBUG module=fetcher appname=mdmamn-eap-anlagenobjekte message="Adding fetch request for partition TopicPartition(topic='mdmamn.test.v2.infrastrukturobjekt.json', partition=5) at offset 6045066"
timestamp=2025-05-01T13:12:47.910 thread=24384 loglevel=DEBUG module=fetcher appname=mdmamn-eap-anlagenobjekte message="Built full fetch <kafka.consumer.fetcher.FetchMetadata object at 0x0000028A7A232BC0> for node 4 with 2 partition(s)."
timestamp=2025-05-01T13:12:47.910 thread=24384 loglevel=DEBUG module=fetcher appname=mdmamn-eap-anlagenobjekte message="Built full fetch <kafka.consumer.fetcher.FetchMetadata object at 0x0000028A7A232BC0> for node 2 with 1 partition(s)."
timestamp=2025-05-01T13:12:47.910 thread=24384 loglevel=DEBUG module=fetcher appname=mdmamn-eap-anlagenobjekte message="Built full fetch <kafka.consumer.fetcher.FetchMetadata object at 0x0000028A7A232BC0> for node 1 with 3 partition(s)."
timestamp=2025-05-01T13:12:47.910 thread=24384 loglevel=DEBUG module=fetcher appname=mdmamn-eap-anlagenobjekte message="Sending FetchRequest to node 4"
timestamp=2025-05-01T13:12:47.911 thread=24384 loglevel=ERROR module=fetcher appname=mdmamn-eap-anlagenobjekte message="Fetch to node 4 failed: NodeNotReadyError: 4"
Thank you
Metadata
Metadata
Assignees
Labels
No labels