-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 connection makes the ESP8266 unresponsive #847
Comments
What rules do you have active? |
For now I did not have any rules or plugins configured. |
Hmm that sounds like reproducible :) |
I also have espeasy running a node MCU v3, that works like charm. But that runs a different version, a few weeks earlier, but I have some troubles downgrading the firmware on my sonoff. Now it wont come back at all :-( |
You could erase all flash content using ESPtool.py I had something similar a few weeks ago, that's why I created this issue: #791 |
Ok, I did some more research. USB powered, controller enabled. USB powered, controller disabled. So on USB is it still responsive... |
oh btw, |
Hmm als tried earlier versions? |
I agree that the issue sounds a bit vage. That works fine until it connector to my MQTT broker. I have also tried enabling NTP, but that did not make a change. |
OK, so there is still something weird with the (OpenHAB???) MQTT controller. |
It is set by IP, port default and no username or password. Rest of settings also default. |
Perhaps also on a NodeMCU? And I will have a look at the CPU load wrt to the MQTT controllers later this evening. |
Yes will test that as well. |
Hmm there is some really fishy code in the OpenHAB controller plugin: Lines 72 to 79 in aec539b
I think I know what is meant here and I hope it is what the compiler will do. Also there is no check in the code if the plugin is enabled. |
Ik can check that, but that will take me few days to get back to you. |
MQTT : Connected to broker with client ID: ESPClient_60:01:94:0E:65:90 Subscribed to: /Varmepump2/# |
Re-implementation of PR letscontrolit#482 which was done on Mega branch. Just to keep merges simple between branches. (and improve readabilit) Also added a simple check to C005 (OpenHAB MQTT) on receiving messages. (see letscontrolit#847 )
I added a very basic test to the OpenHab controller to at least ignore incoming messages when not enabled. |
This appears to be a bigger issue than first thought and may affect all MQTT based controllers. It looks like the MQTT controller is trying too hard to (re)connect and thus freezes the ESP right after booting. This reconnect behavior has changed quite recently in "[issue #728] Proper reconnect for MQTT controllers (#737)" |
Isn't it pubsubclient bug?
Do we have any control on it (or debug) ?
12.02.2018 11:02 PM "Gijs Noorlander" <notifications@github.com> napisał(a):
… This appears to be a bigger issue than first thought and may affect all
MQTT based controllers.
It looks like the MQTT controller is trying too hard to (re)connect and
thus freezes the ESP right after booting.
This happens with Domoticz as well as OpenHAB MQTT.
This reconnect behavior has changed quite recently in "[issue #728
<#728>] Proper reconnect
for MQTT controllers (#737
<#737>)"
Maybe adding some kind of delay when connecting wasn't successful?
Such a delay will also call to run background processes.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#847 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHOUwBrDk9tZZZbIIBm57hAtj1Lg1Qfks5tULTugaJpZM4SBWNV>
.
|
Maybe a little too early, but at least for my ESP my fix seems to work. Daniel is trying on his version with OpenHAB MQTT issues..... |
ill try to add the rest of the controllers to the regression test ASAP. |
I found a note elsewhere that with a Sonoff one needs to disable serial logging for the unit to maintain stability with a Sonoff Basic. I have not Basic's running MQTT, but I have POW's and they get sluggish on the wire with serial debugging on, but never stop. |
Hmm, that sounds like something worth investigating. |
I did a quick test by disable the serial connection, and enable the mqtt controller. It works! When I enable the serial connection again, it immediately becomes unresponsive. |
Hmm, if someone else could reproduce, would be nice. |
I disabled serial log on a unit that is sometimes hard to web connect to. The mem usage dropped a lot (free 12500 before, free 20500 after). |
@ymoona Yes, this pull request :) |
* [issue #869] Added 'LWT' to last will topic and improved CPU load See #869 for discussion on Last Will Topic. Also changed the way it tried to reconnect to make it return a lot faster when connection is not (yet) possible and call the PubSubClient::loop() at a much slower pace to reduce CPU usage. (See #847) This higher CPU load was probably introduced when fixing #683. * [MQTT] Fix error reporting success status with longer payloads Applied PR https://github.com/knolleary/pubsubclient/pull/360/files * made MQTT_CALLBACK_SIGNATURE for esp32 functional Applied PR knolleary/pubsubclient#336
When OpenHAB MQTT controller was selected, the web interface becomes unresponsive when the controller tab was selected. Also the ESP almost freezes when MQTT messages were sent. This is an attempt to make them work faster. Also a lot of string manipulation, copies and resizes are now no longer needed and the received values are checked to be valid int or float before used.
* [issue #847 ] OpenHAB MQTT rewrite topic parser When OpenHAB MQTT controller was selected, the web interface becomes unresponsive when the controller tab was selected. Also the ESP almost freezes when MQTT messages were sent. This is an attempt to make them work faster. Also a lot of string manipulation, copies and resizes are now no longer needed and the received values are checked to be valid int or float before used. * signed unsigned warning
I have tested with build: Release v2.0-20180217 |
Could you please look at the logs (or via MQTT client) to see if MQTT looses connection to the broker? Ping is a bit tricky to use as a monitoring tool, since reply to ping is optional. It may be omitted when the server is too busy. (where the definition of "too busy" is quite vague) The MQTT doesn't have higher prio, but it is just scheduled differently now. Lines 1292 to 1304 in 5c4defd
The "250" was just a wild guess on my side, since it is hard to predict what effects it will have. The 500 value was already there, but used for retry when the broker could not be reached. Also try to look at the uptime. Just to make sure it doesn't reboot. |
With connection I indeed mean ping or webserver response. |
I have done some tests Have not tested other values yet. |
There are some other delays introduced recently. |
@ |
Hmm that reply may need some explanation ;) |
It seems there is no wifi connection problem as changes to the WiFiConnected function dont make a difference. |
Which values do you mean? The update interval to process the MQTT? (the "250 ms" value) Edit: |
No I meant the this part: |
OK, so if that's too low, it will 'choke' the ESP on requests? Funny part is, that its original implementation (at the start of this thread) was way shorter interval. Now does the call to the PubSubClient::loop() function do a bit more, but still it is currently a lot less than it used to be. I just have to think more in streaming mode and do baby steps each run of the main loop. |
…B MQTT Thanks [jivkopavlovski](letscontrolit@f23d9fa#commitcomment-27660279) for pointing this out (and testing ofcourse)
[issue #847] Fix last letter of command is cut in OpenHAB MQTT
See letscontrolit#922 and letscontrolit#847 Problem with DNS resolve is that it is quite slow when resulting in a failure and it tends to keep the ESP occupied and make it unresponsive. Changed the way it is connecting to a controller. Not sure if http requests are still OK, maybe we should make an exception for those when selected to use DNS.
See #922 and #847 Problem with DNS resolve is that it is quite slow when resulting in a failure and it tends to keep the ESP occupied and make it unresponsive. Changed the way it is connecting to a controller. Not sure if http requests are still OK, maybe we should make an exception for those when selected to use DNS.
Has this issue been improved with the last few days of commits? |
Recently a lot has changed on how services will be started and connections made. Is this still an issue? |
I have flashed them with tasmota and they are not accessible anymore as they built in. So I cannot thest this anymore. Sorry |
OK, understandable. |
Fine by me
Op vr 23 mrt. 2018 16:19 schreef Gijs Noorlander <notifications@github.com>:
… OK, understandable.
Should I close this issue?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#847 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AC1lHw_8jCgtCLzscEeuK7xiwRbnlsRcks5thRKKgaJpZM4SBWNV>
.
|
Hi - i'm trying to control a neopixel candle from Home Assistant. I've tried using MQTTBox to change the settings of the candle (type, brightness, color) but nothing appears to change. this bug appeared to be related. My espeasy install version is: |
NOTE: This is not a support forum! For questions and support go here: https://www.letscontrolit.com/forum/viewforum.php?f=1
Steps to reproduce
How can we trigger this problem?
Configure a controller to OpenHAB MQTT, I have no password/user
Enable the controller, once connected (check the log) esp8266 becomes unresponsive.
Part of the console log of a ping:
64 bytes from 192.168.1.13: icmp_seq=1090 ttl=128 time=5.293 ms
64 bytes from 192.168.1.13: icmp_seq=1091 ttl=128 time=5.469 ms
64 bytes from 192.168.1.13: icmp_seq=1092 ttl=128 time=5.381 ms
64 bytes from 192.168.1.13: icmp_seq=1093 ttl=128 time=5.193 ms
64 bytes from 192.168.1.13: icmp_seq=1094 ttl=128 time=35.700 ms
64 bytes from 192.168.1.13: icmp_seq=1095 ttl=128 time=5.033 ms
Request timeout for icmp_seq 1096
Request timeout for icmp_seq 1097
Request timeout for icmp_seq 1098
Request timeout for icmp_seq 1099
Request timeout for icmp_seq 1100
Request timeout for icmp_seq 1101
Request timeout for icmp_seq 1102
Request timeout for icmp_seq 1103
Request timeout for icmp_seq 1104
Request timeout for icmp_seq 1105
Request timeout for icmp_seq 1106
Request timeout for icmp_seq 1107
64 bytes from 192.168.1.13: icmp_seq=1108 ttl=128 time=150.382 ms
Request timeout for icmp_seq 1109
Request timeout for icmp_seq 1110
Request timeout for icmp_seq 1111
Request timeout for icmp_seq 1112
Request timeout for icmp_seq 1113
Request timeout for icmp_seq 1114
Request timeout for icmp_seq 1115
Request timeout for icmp_seq 1116
64 bytes from 192.168.1.13: icmp_seq=1117 ttl=128 time=201.001 ms
First it was fine, the first timeout is just after I start the MQTT broker on server side. I can clearly reproduce it by stopping or starting the MQTT broker.
Does the problem presist after powering off and on? (just resetting isnt enough sometimes)
Power it on with MQTT broker running and configured makes the ESP8266 very unresponsive.
Power it on with MQTT broker NOT running gives me a perfect responsive ESP8266
Expected behavior
I would like to use MQTT and have a responsive system
Actual behavior
Tell us what happens instead?
When MQTT client is connected the system is highly unresponsive
System configuration
Hardware:
Sonoff basic
Software or git version:
ESP_Easy_v2.0-20180209_normal_ESP8266_1024
The text was updated successfully, but these errors were encountered: