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
ManagedMqttClient Issue with sending message just after Start. #1849
Comments
I have a similar problem. I am using the server and the client in an XUnit test, and in my test method, I get very erratic behavior. With waiting for half a second after starting the client and after subscribing, I receive messages about half the time. Currently, my solution is to ditch the managed client and use the unmanaged one, implementing the reconnection logic myself. |
The point is that I am facing similar issue in my normal execution environment (Windows 10 Machine) in some rare cases. I'll try with a regular console application. |
While testing with external broker (Mosquitto in that case) I don't have the issue, the code works perfectly without Task.Delay. |
Any update on this? I'm having a very similar issue where I need about a half a second delay between starting the managed client and subscribing or I miss messages |
Hello,
Describe the bug
I have the following case:
One server, one client (producer), another client (consumer).
I start the server.
I start the producer and I send immediately a message with retain flag.
I start the consumer and subscribe to the topic.
I am facing a strange behavior where sometimes, the retained message is not received by the consumer.
I am able to work around if I add a Task.Delay(1) between the start of producer and the enqueue of the message.
Which component is your bug related to?
To Reproduce
Open the attached visual studio solution, execute the unit tests.
There is 2 tests, one where the server is restarted at each loop, another where the server is started only once.
I have Theory, (one with Task.Delay(0) failing, one with Task.Delay(1) success)
Expected behavior
A reproducible behavior without Task.Delay or a way to be sure that initialization is ok.
Code example
See attached solution.
MqttNetTester.zip
The text was updated successfully, but these errors were encountered: