fsprojects / pulsar-client-dotnet

Apache Pulsar native client for .NET (C#/F#/VB)
MIT License
301 stars 47 forks source link

Dead lock when consumer enable retry and call "isConnected" multiple times #247

Closed Genuineh closed 5 months ago

Genuineh commented 8 months ago

Hello, thanks for your contribution,i found dead lock when i enable the retry option and call "isConnected" multiple times. And I have found the code that may potentially cause a deadlock.

member this.IsConnected =
    (postAndAsyncReply mb IsConnected).Result

Async method used in sync method like ".Result" maybe cause a dead lock. I think we can change all method to async or check async method‘s execution status in loop to instead of ".Result".

Lanayx commented 8 months ago

I've made updates in 3.2.0, please check

Genuineh commented 8 months ago

The basic test is fine, but more usage scenarios are needed to verify that deadlock has been eliminated