-
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
[Bug]: Does not start reconnect timer on connection error #1947
Comments
This reminds me of the opposite a user asked for, I'm not sure but this may have changed in one of the latest versions (or maybe I remember this wrong). Could you try to check If there is a specific version that introduced this? |
I went back to v5.0.0 and it did the same thing. Going back into v4.x is hard to integrate with the existing test code I have due to increasing changes in the typescript types. Rummaging through the source history, I finally found this: https://github.com/mqttjs/MQTT.js/pull/1076/files?diff=unified&w=1#diff-ca407d959d33ce92a7f7efee354a5ea5e6e61fcd797d32c04205e429a074ed54L256-L259 It seems vaguely relevant if the connection error would have triggered the close event in that case, but I'm not sure. Other than that, I don't see much sign that the reconnect timer would have ever been setup in the case of the initial connack packet reporting an error. |
@mgabeler-lee-6rs would you like to submit a PR? I think this could also be opt-in behind a connect option |
I'll work one up 👍 |
I've started a draft, it needs tests & some thought on naming at least (the option name seems ... quite verbose right now): #1948 |
MQTTjs Version
5.10.1
Broker
emqx
Environment
NodeJS
Description
If a connection attempt is met with a connack packet with an error (e.g. an auth error), no reconnect is attempted.
With expiring auth keys, such connack errors are expected. Our app is setup to trigger auth refresh on those errors using the suggested methods from other issues, but the client never actually sets up the reconnect timer in this case.
Minimal Reproduction
I expect this to keep retrying, but it does not.
Debug logs
These logs are from a test hitting our real broker with bogus creds. The test is nearly identical to the repro above. I have intentionally provided a wrong
password
in the test to reproduce the issue. I have also elided the username, client id, and broker hostname.MQTT logs nothing more after this, since ... it's not doing anything.
The text was updated successfully, but these errors were encountered: