-
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
Calling reconnect() causes endless connect/disconnect loop #1152
Comments
I noticed that if I call |
For reference, something like this worked for me.
|
so the issue is that it gets trapped in a reconnect loop? But by calling end and then reconnect, there's no loop, it just reconnects? |
@YoDaMa Yes that's what I saw. You should be able to reproduce it with the snippet at the very top. |
Posting logs with debugs enabled from the repro:
Looks like the problem is that we do not check if the client is connected or not when reconnecting, and then call
|
This fixes Bug #1152, where calling reconnect can cause endless connect/disconnect loop.
I tested this with mqtt@4.2.1 and node 12.16.3.
Something as simple as this:
Gives this output:
I'm going to poke around a little and see if I can't figure out why, but in the meantime I saw that:
close
event because the Socket was closednull
is written to the stream, which looks like that signals the end of the stream. Thenull
is written because some node internals gets anarrayBuffer
ofundefined
insideonStreamRead
... but idk how to debug that any deeper because of async stack traces :/The text was updated successfully, but these errors were encountered: