question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CPU Leak if you specify Username/password

See original GitHub issue

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% 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:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
GioviQcommented, Jan 8, 2018

@ngducnghia you can even just commit from Visual Studio.

0reactions
ngducnghiacommented, Jan 8, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found