dotnet / MQTTnet

MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
MIT License
4.4k stars 1.06k forks source link

Client application is missing messages at higher loads on 32bit .Net 4.8 applications. #1812

Open vinaybr opened 1 year ago

vinaybr commented 1 year ago

Client application is missing DataReceived events

Which component is your bug related to?

To Reproduce

Expected behavior

All clients should receive all the messages

Screenshots

-

Additional context / logging

vinaybr commented 1 year ago

an update to the issue here, we are seeing messages missed and in some cases received in wrong order. its more frequent in 32bit .net4.8 but happens even on 64bit .Net6.

coffeeaddict19 commented 1 year ago

In mqttnet, the default QoS subscription for a topic is 0. That may explain why you are missing messages or seeing them in an unexpected order. Not having seen a sample of your connection code this is only a guess.

Example ...

var subscriptionOptions = m_mqttFactory.CreateSubscribeOptionsBuilder(); foreach(var topicname in connectionData.TopicsToSubscribeTo) { subscriptionOptions.WithTopicFilter(topicname, MqttQualityOfServiceLevel.ExactlyOnce); } await m_client.SubscribeAsync(subscriptionOptions.Build(), m_cancel);

tkouba commented 5 months ago

I have about 13500 retained messages/topics, but I can receive only 1179. The same number after many runs. I tried change QoS of subscription, nothing. Broker mosquitto.