You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've identified a problem in my application where when I try to dispose disconnected producers my thread will block forever.
Whenever I attempt to publish a message I first lazy load a producer. I have code that looks something like:
// Is the existing producer good?if(awaitproducer.IsConnected())returnproducer;// Dispose the dead producerawaitproducer.DisposeAsync();// Create a new producerreturnawaitCreateProducerAsync();
I'm running the official Pulsar Docker image and successfully publishing messages to it. If I restart the container, breaking the connection, my application will hit the DisposeAsync() and block forever.
First of all, .IsConnected() is just for informational purpose, you shouldn't dispose producer based on that, since it can be in Connecting state. As for blocking forever, I've published https://www.nuget.org/packages/Pulsar.Client/3.5.3 to fix a related issue, it might help you as well. If not, can you please provide more details and debug logs (good example)
Hello!
I've identified a problem in my application where when I try to dispose disconnected producers my thread will block forever.
Whenever I attempt to publish a message I first lazy load a producer. I have code that looks something like:
I'm running the official Pulsar Docker image and successfully publishing messages to it. If I restart the container, breaking the connection, my application will hit the DisposeAsync() and block forever.
Looking at the dispose method for ProducerImpl it looks like it doesn't really do anything if the connection state is closed. https://github.com/fsprojects/pulsar-client-dotnet/blob/develop/src/Pulsar.Client/Internal/ProducerImpl.fs#L935
As a workaround I'm simply not disposing my producers if they're no longer connected anymore. Is this safe?
The text was updated successfully, but these errors were encountered: