question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory leak on a monitoring service (DependentAdminClient)

See original GitHub issue

Description

I have built a monitoring service on .Net Core 3.1 and Confluent.Kafka 1.7.0 RC4 which wakes up every ~ 20 sec and runs multiple admin tasks. All methods are static and then summary is appended to a local log file until next cycle. Running this service for 3 days on Windows 10 with perfmon shows a memory leak with increasing use of Working set (starting with 90 MB and climbing linearly to 400 MB after 3 days). All other measured metrics (CPU, thread count, handles, Virtual bytes) were flat.

The service is doing the following tasks every 20 sec with sleep in between: (1) Check the brokers availability (admin) (2) Check brokers configurations (3) List all topics and partitions (4) Check topics configurations (5) Check Consumer lag for given topics/consumer-groups (6) Check partitions replications and ISR (7) Check produce rate of the topics

All the methods are static This was tested is a pre-production environment so there isn’t a nigh volume of messages going in/out the Kafka cluster.

Admin client is re-created on each call type with this pattern: using (var adminClient = new AdminClientBuilder(new AdminClientConfig { BootstrapServers = mBootstrapServers }).Build()) { var meta = adminClient.GetMetadata(mConnectTimeout); meta.Brokers.ForEach(broker => available_brokers.Add($"{broker.Host.ToLower()}:{broker.Port}")); } This example shows how to get the admin brokers info, similar approach for getting topics etc. All the methods are static.

Attached is the Windows perfom chart report. kafka_net_client_service

How to reproduce

Repeatedly get broker, topic, partitions, consumers configurations every ~ 20 sec across several days.

Checklist

Please provide the following information:

  • A complete (i.e. we can run it), minimal program demonstrating the problem. No need to supply a project file.
  • Confluent.Kafka nuget version.
  • Apache Kafka version.
  • Client configuration.
  • Operating system.
  • Provide logs (with “debug” : “…” as necessary in configuration).
  • Provide broker log excerpts.
  • Critical issue.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mhowlettcommented, Jul 27, 2021

It’s somewhat morphed, but fine to keep this issue open. To double confirm, this happens when you are not frequently disposing the DependentAdminClient? If so, balance of probabilities has this as a librdkafka issue for me. Transitioning this to bug.

0reactions
anchitjcommented, Dec 13, 2022

Is this still reproducible with the latest version(1.9.3)? I am unable to reproduce it with the latest release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use Performance Monitor to find a user-mode memory leak
Learn how to use Performance Monitor to find a user-mode memory leak and to measure the memory usage of individual processes.
Read more >
Memory leak detection - How to find, eliminate, and avoid
Mature software organizations will often use automated tools to detect memory leaks in running applications. How can I prevent a memory leak? As ......
Read more >
Fixing memory leaks in web applications | Read the Tea Leaves
One of these problems is memory leaks. A poorly-coded SPA can easily eat up megabytes or even gigabytes of memory, continuing to gobble...
Read more >
Node.js Memory Leak Detection: How to Debug & Avoid ...
In this article, you'll learn how to understand and debug the memory usage of a Node.js application and use monitoring tools to get...
Read more >
Tracking Down a .NET Windows Service Memory Leak
Yes, there is a tool to analyze memory leaks. It just isn't free. However you might be able to identify your problem within...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found