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

Kafka Consumer disposed twice #1283

Open
rngcntr opened this issue Mar 13, 2025 · 0 comments
Open

Kafka Consumer disposed twice #1283

rngcntr opened this issue Mar 13, 2025 · 0 comments

Comments

@rngcntr
Copy link
Collaborator

rngcntr commented Mar 13, 2025

When disposing a MotorHost, the KafkaMessageConsumer is stopped and disposed. Both operations seem to be in conflict, judging from the exception message:

System.ObjectDisposedException: handle is destroyed
   at Confluent.Kafka.Impl.SafeKafkaHandle.ThrowIfHandleClosed()
   at Confluent.Kafka.Impl.SafeKafkaHandle.ConsumerClose()
   at Confluent.Kafka.Consumer`2.Close()
   at Motor.Extensions.Hosting.Kafka.KafkaMessageConsumer`1.StopAsync(CancellationToken token)
   at Motor.Extensions.Hosting.Consumer.TypedConsumerService`1.StopAsync(CancellationToken token)
   at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
   at Microsoft.Extensions.Hosting.Internal.Host.StopAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.WaitForShutdownAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Program.<Main>$(String[] args) in /some/private/directory/Program.cs:line 11
   at Program.<Main>(String[] args)
   at InvokeStub_Program.<Main>(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
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