-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
The client keeps node alive if end() is called before the connection is established #1033
Comments
Thanks for the script to reproduce. I changed delay to 5000, saw it log the connect message, then the closed message 5 seconds later, and I'm running Node.js v12.14.0 on macOS. What about you? Also, what broker are you running on localhost? I tested with test.mosquitto.org. |
Based on your edits, can confirm that setting delay to 0 does hang for 90 seconds. |
Thanks for the confirmation. Btw. I'm on Windows 10, using node v10.15.1 and mosquitto version 1.5.8. |
This is an automated message to let you know that this issue has If this issue is still important, you can simply comment with a Thank you for your contribution. |
This issue was automatically closed due to inactivity. |
If I set up an MQTT connection and for some reason, I want to exit the program during startup, calling
client.end()
is not enough to quit the event loop. The process hangs up for some 90 seconds before exiting. Although if I wait a few seconds to allow the connection to be established and only then I callclient.end()
, node exits as expected. Here is a sample that produces the issue.The text was updated successfully, but these errors were encountered: