Skip to content
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

Fix runaway thread issue where MqttClient uses 100% CPU when disconnected #75

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mhellsten
Copy link

During contention conditions, the broker (for example RabbitMQ) might disconnect the client before it is fully initialized. This might put MqttClient's ReceiveThread thread into a tight loop that it never recovers from, running the client machine out of CPU resources.

@mhellsten
Copy link
Author

I don't know why the Eclipse validation is not passing. I have signed the ECA, the author of the commits is the same as the email I signed with, and I added sign-offs with that same author email.

@fpagliughi
Copy link

If you just signed the ECA, give it a day or two. It seems that there is a bit of a delay in the ECA's getting back to GitHub.

…cer in front of them, the connection may be accepted even though nobody is listening. In that situation, when reconnecting, we may end up waiting indefinitely for the KeepAlive thread to exit, when in fact it already stopped as part of the original disconnection event.
@bartsipes
Copy link

Is there any update on when this PR might be completed?

@mhellsten
Copy link
Author

FWIW, I've been running my forked version in production since January without issue.

I also ported it to .NET Core. Since other PRs for .NET Core have been ignored, I gave up on running a mainline version. Because I'm unable to find SDKs for some of the old platform targets in the solution, I had no way of building the whole thing, and therefore didn't push those changes to my public fork.

@bartsipes
Copy link

@mhellsten Good to know, thanks for the update

@rickpapo
Copy link

rickpapo commented Jan 19, 2022

I have encountered this problem as well, but with a twist: if you attempt to connect with the wrong user name or password, the connection is rejected, but three receive worker threads are started anyway and spin, hogging the CPU. Do we have any idea when this fix will be merged and published through NuGet?

I see this problem with both versions 3.6 and 4.3.

@mhellsten
Copy link
Author

Do we have any idea when this fix will be merged and published through NuGet?

I wouldn’t hold my breath since the project hasn’t been maintained in three years. You could use my fork to build the package yourself.

@rickpapo
Copy link

rickpapo commented Jan 19, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants