Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.ObjectDisposedException: handle is destroyed

Kafka consumer application is throwing ObjectDisposedException when we initiate the process to stop the consumer service.I would like to understand what process destroyed the kafka handle

System.ObjectDisposedException: handle is destroyed
at Confluent.Kafka.Impl.SafeKafkaHandle.ThrowIfHandleClosed()
at Confluent.Kafka.Consumer`2.Consume(Int32 millisecondsTimeout)
at Confluent.Kafka.Consumer`2.Consume(CancellationToken cancellationToken)
like image 899
sapna gandhi Avatar asked Apr 11 '26 16:04

sapna gandhi


1 Answers

in my case this exception was thrown in .Net Library Confluent Kafka. If you are also using this library, please make sure what you call Consumer.Close() BEFORE Consumer.Dispose().

like image 132
Wafeelka Avatar answered Apr 23 '26 10:04

Wafeelka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!