Memory leak on a monitoring service (DependentAdminClient)
See original GitHub issueDescription
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.
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:
- Created 2 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
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.
Is this still reproducible with the latest version(1.9.3)? I am unable to reproduce it with the latest release.