-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
MQTT client stays connected but becomes stale or unresponsive #1406
Comments
Yes, I have been re-testing and believe we can make this the root issue describing the sequence of events and link the other two issues that are inter related to this one |
In point 6 of the actual behavior above, the auto reconnect does not fire when the MQTT connection has become stale or unresponsive, HOWEVER, the auto reconnect does fire and executes successfully if the mqtt client goes offline immediately after a new mqtt connection has been established. |
@NicolSpies can I ask you to try patch from #1349? Maybe it will establish something... |
@djphoenix unfortunately not possible as I only program in Lua obtained from NodeMCU custom builds. |
OK, try out this binary: link |
Thanks, will try as soon as I have time (in few days). |
@NicolSpies any progress or reports here? |
@djphoenix, apologies for only getting to it now. Good news..
|
Thanks Nicol for testing. I conclude that the code Yuri provided fixes all the problems you reported, correct? If so, then please close this issue. Looks like we only need to track #1349 then and hope Yuri finds the time to turn that patch into a PR. |
Agreed, on all points, my money is on Yuri for the PR. 👍 |
Additional information: It may be a new condition not discovered before. It might be that that the connection is fine hence no offline triggering but, the moment a message is received a disconnect happens hence the lwt triggering. During this condition the on message method is not triggered as normally happens when the connection is responsive. Something else that might be of value. I publish a message every 60 seconds but messages are not received often. @djphoenix, Hi Yury, I have been testing the last dev merge for #1445 since the release. The sequence of events is that the connection becomes unresponsive. Offline method is not triggered. When a mqtt message is received the lwt is immediately triggered. As before the re-connection is not initiated most probably because the offline is not triggered. The strange thing is that it worked for a while and then stopped without making any changes to the way mqtt is used. Formatting and reflashing the ESP with the originally "working" build does not restore the operation. |
@NicolSpies Hello again. |
@NicolSpies I still can't quite picture what the real issue is but I suspect it should be tracked separately. |
Hi, I am testing "in the wild" on two identical units in a production-like environment in order to obtain a clearer picture of the real issue. Will report back when a pattern emerges. |
Thanks Nicol, feel free to create an issue here then. |
Expected behavior
If the MQTT connection becomes stale or unresponsive the MQTT Client should trigger the offline event and automatically reconnect if the client:connect method has been configured to auto reconnect.
Actual behavior
Test code
-- The standard example code in the NodeMCU documentation is used
NodeMCU version
Lua 5.1.4 on SDK 1.5.1(e67da894)
branch: dev
commit: adf7173
SSL: false
modules: adc,bit,cjson,enduser_setup,file,gpio,i2c,mdns,mqtt,net,node,rotary,rtctime,sntp,tmr,uart,wifi
Hardware
ESP12-E is used in a standard configuration.
The text was updated successfully, but these errors were encountered: