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

Multiple calls to list_offsets() may cause memory leaks #1901

Open
3 of 7 tasks
whuwangjj opened this issue Jan 9, 2025 · 0 comments
Open
3 of 7 tasks

Multiple calls to list_offsets() may cause memory leaks #1901

whuwangjj opened this issue Jan 9, 2025 · 0 comments

Comments

@whuwangjj
Copy link

whuwangjj commented Jan 9, 2025

Description

When the list_offsets() method of the AdminClient is invoked for multiple times, memory leakage occurs and the memory usage keeps increasing.

image

image

image

How to reproduce

                  
        self.admin_client = AdminClient({'bootstrap.servers': 'xxx:xxx',
                                         'security.protocol': 'SSL',
                                         'ssl.ca.location': 'xxx',
                                         'ssl.certificate.location': 'xxx',
                                         'ssl.key.location': 'xxx',
                                         'ssl.key.password': 'xxx',
                                         'ssl.endpoint.identification.algorithm': 'none'
                                         })

        def run(self):
            while True:
                try:
                    topic_partition_offsets = {}
                    for partition in [0, 1, 2]:
                        topic_partition = TopicPartition("testtopic", partition)
                        topic_partition_offsets[topic_partition] = OffsetSpec.latest()

                    list_offset_futmap = self.admin_client.list_offsets(
                        topic_partition_offsets, request_timeout=30)
                    for partition, fut in list_offset_futmap.items():
                        try:
                            print(f"topic: {partition.topic}, partition: {partition.partition}, offset {fut.result().offset}")
                        except Exception:
                            print(f"get offset error. occurred with {partition.topic}:[{partition.partition}]")
                            continue
                except Exception as exc:
                    print("got error.%s", exc)
                    print(traceback.format_exc())
                finally:
                    time.sleep(0.1)

This problem occurs when the list_offsets interface is invoked for multiple times. testtopic indicates the created topic. There are three partitions and a few message offsets.

image

image

Checklist

Please provide the following information:

  • confluent-kafka-python and librdkafka version (confluent_kafka.version('2.3.0') and confluent_kafka.libversion('2.3.0')):
  • Apache Kafka broker version: 3.5.0
  • Client configuration: {...}
  • Operating system: linux
  • Provide client logs (with 'debug': '..' as necessary)
  • Provide broker log excerpts
  • Critical 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

1 participant