confluentinc / confluent-kafka-dotnet

Confluent's Apache Kafka .NET client
https://github.com/confluentinc/confluent-kafka-dotnet/wiki
Apache License 2.0
2.78k stars 847 forks source link

Provide a way to unsubscribe from LogHandler/ErrorHandler #2184

Open horato opened 5 months ago

horato commented 5 months ago

Description

There is currently no way to remove the referenced Actions from Producer/Consumer which might cause a memory leak.

var producer = new ProducerBuilder<string, string>(producerConfig)
        .SetLogHandler(LogHandler)
        .Build();

How to reproduce

Confluent.Kafka 2.3.0 librdkafka 2.3.0

Checklist

Please provide the following information:

quixoticaxis commented 3 months ago

What is the scenario for memory leaking? When you're done with the producer, the handlers would go with it.

anchitj commented 1 month ago

Can you provide more details?

horato commented 1 month ago

I am not sure what more details you want me to provide. I need a way to unsubscribe/unset reference to error/log handlers actions as described in the issue's title and description. Namely

ProducerBuilder<,>.ErrorHandler
ProducerBuilder<,>.LogHandler
Producer<,>.errorHandler
Producer<,>.logHandler