CPU Leak if you specify Username/password
See original GitHub issueHi,
Im using M2MQTT from https://www.nuget.org/packages/M2Mqtt/ IF i create a client and specify a user name the CPU usgae goes up by 25% and stays there even if the connection fails due to wrong credentials. And next call to connect will increment the CPU usage by 25%
So if you have multiple thread connecting to MQTT server, after a couple of calls the CPU reached 100% and crashes. Following code can reproduce the issue, add it to a Console application .Net 4.5 or greater:
Console.WriteLine("start?");
Console.Read();
Console.WriteLine("starting, please monitor the CPU usage.");
List < MqttClient > l = new List<MqttClient>();
for (int i = 0; i < 10; i++)
{
var client = new MqttClient(
"test.mosquitto.org"
, 1883
, false
, null
, null
, new MqttSslProtocols());
client.MqttMsgPublishReceived += Client_MqttMsgPublishReceived;
try
{
client.Connect(Guid.NewGuid().ToString(), "ss", null);//intentionally making it fail with wrong credentials
}
catch(Exception ex) { Console.WriteLine("Error"); }
l.Add(client);
}
Console.WriteLine("Exit?");
Console.Read();```
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
CPU Leak if you specify Username/password · Issue #66
Hi, Im using M2MQTT from https://www.nuget.org/packages/M2Mqtt/ IF i create a client and specify a user name the CPU usgae goes up by 25% ......
Read more >Indexer process periodically eats all cpu and memory
We have to periodically remove node from cluster and rebuild indices. Is it known issue with community edition 6.0? What info should we...
Read more >Cornerstone causing high CPU usage constantly - Support
after checking cloudlinux and cpu usage logs. I'm seeing multiple CPU processes utilizing php-fpm on php 7.0 showing cornerstone plugs with this error....
Read more >Asus router one CPU core 100% usage? :: SG FAQ
Turn off QoS - if you still see high CPU usage, under "Adaptive QoS > QoS", choose ... Use the same admin username/password...
Read more >Cluster resource usage check issue - ITOM Practitioner Portal
Error: if the usage is greater than 90%. Cause. The resource usage of the worker nodes is out of balance. Solution. Check the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@ngducnghia you can even just commit from Visual Studio.
@GioviQ I forked and submit PR. https://github.com/eclipse/paho.mqtt.m2mqtt/pull/79 I see the code in gnatmq client already have a check for exception. I added another check so if returnCode != CONN_ACCEPTED, it also set isRunning to false to exit the loop in ReceiveThread method.