-
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
Esp easy update temperature to domoticz generate a reboot #674
Comments
What controller are you using? e.g. http/MQTT? Also screenshots of the device tab and/or controller would be nice. |
What controller are you using? e.g. http/MQTT?: I setup Domoticz Http controller |
It also happens on the switch input. |
As described in letscontrolit#673 . The problem was partly related to the default values stored in flash ("0"), which was not a valid value for the switch type. When upgrading from an older version of ESPeasy, make sure to check the switch type (normal switch or dimmer) and save the settings for the switch device again, even when nothing was changed. Default configuration and new added switches will now work like intended. When a controller is enabled (e.g. Domoticz MQTT or -HTTP) and the button is pressed multiple times, the ESP may reboot. See issue letscontrolit#674.
Just before the crash, it reports Exception (2).
Taken from this list, which appears to be:
|
As described in #673 . The problem was partly related to the default values stored in flash ("0"), which was not a valid value for the switch type. When upgrading from an older version of ESPeasy, make sure to check the switch type (normal switch or dimmer) and save the settings for the switch device again, even when nothing was changed. Default configuration and new added switches will now work like intended. When a controller is enabled (e.g. Domoticz MQTT or -HTTP) and the button is pressed multiple times, the ESP may reboot. See issue #674.
sounds serious, ill try to reproduce it as well. |
I was just playing around with running background tasks just to make sure the watchdog is not kicking in. with multiple controller messages in a short time. So I added something like this: void sendData(struct EventStruct *event)
{
if (timePassedSince(lastSend) < 1000) {
// Frequent subsequent calls to the controller.
// Perform yield first to make sure the wdt reset will occur.
//yield();
delay(1);
} Somewhat inspired by #676 and also what was discussed here: esp8266/Arduino#1997 (comment) But adding that code will lead to much more frequent crashes. So lots of possibilities. Any suggestion on how to analyse the stack? |
I think there was some stack analyser for platformio or arduino GUI, but i forgot how it was named. It could translate the stack dump to a nice backtrace. |
Hmm, when built using the Arduino IDE, I cannot get it to crash. It uses the same config, since that was not changed between flashes. Problem is, I now have a stacktrace via Arduino IDE, but it doesn't make sense, so I guess the images are actually different in build settings. (the .elf file is significantly smaller when built using PlatformIO)
|
I added the option "-g3" to the PlatformIO build flags and now I believe I have some stacktrace:
|
Some update. Also related to what @s0170071 already noticed in #676 Things to rule out: (at least not related to this issue) And similar: That made no difference. In SendData() (Controller.ino) I removed Then you only get the controller to crash when pressing the switch intensively for a number of seconds. So I added a The code is also rather fishy about checking only controller 0 for being enabled or having MQTT use. I think I can fix the issue with the switch by delaying consecutive updates and only sending the last one when pressing the switch very frequently. But I think the real problem is with the sendData function and the background services. So other plugins may experience similar issues. |
Have you tried core 2.3.0 ?
…-------- Ursprüngliche Nachricht --------
Von: Gijs Noorlander <notifications@github.com>
Gesendet: 7. Januar 2018 01:04:20 MEZ
An: letscontrolit/ESPEasy <ESPEasy@noreply.github.com>
CC: s0170071 <drk@posteo.de>, Mention <mention@noreply.github.com>
Betreff: Re: [letscontrolit/ESPEasy] Esp easy update temperature to domoticz generate a reboot (#674)
Some update. Also related to what @s0170071 already noticed in #676
Things to rule out: (at least not related to this issue)
In PubSubClient.cpp I added 2 checks to make sure no out-of-bound issues with the buffer were causing these crashes:
Changed:
(line 247) ` } while ((digit & 128) != 0); `
To:
` } while ((digit & 128) != 0 && len < (MQTT_MAX_PACKET_SIZE -2)); `
And similar:
Changed:
(line 528) `while (*idp) { `
to:
` while (*idp && pos < (MQTT_MAX_PACKET_SIZE - 2)) { `
That made no difference.
In SendData() (Controller.ino) I removed
`delayBackground(delayms);`
Then you only get the controller to crash when pressing the switch intensively for a number of seconds.
This results in a panic, with the watchdog kicking in:
`Panic C:\users\gijs\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_main.cpp:98 __yield
`
So I added a `yield();` , but that made no difference.
The code is also rather fishy about checking only controller 0 for being enabled or having MQTT use.
I think I can fix the issue with the switch by delaying consecutive updates and only sending the last one when pressing the switch very frequently. But I think the real problem is with the sendData function and the background services. So other plugins may experience similar issues.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#674 (comment)
--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
|
I'm only running on core 2.3, since that's the version with ESPeasy |
My crash was from an Arduino IDE build. So the problem is still there. Had sth. similar a while ago. In the end it was a uninitialized variable in an interrupt function. One compiler setting initialized it to zero, the other didn't. |
Hmm, that may be a good pointer to start looking, since in the Arduino IDE the crash was at least much harder -if not impossible- to reproduce. |
If you set a message delay of 30000ms at the advanced settings page, this bug gets triggered every time. I'll try to figure out whats going on and i'll test your PR as well. Also i wonder what happens if a MQTT message arrive and the mqtt callback is called when doing a delaybackground somewhere. |
i added a bunch of debug statements and indeed its crashing on the mqtt stuff in background tasks. the easy way out would be to move MQTTclient.loop() to loop() so that its never called from delayBackground() will try to see if i can pinpoint the exact reason of the crash. |
woops found a probably unrelated bug in mqtt callback:
threre is no return, so too big messages would be processed and cause a crash still. |
@psy0rz Good find. I remember looking at that part and finding it a bit strange, but didn't trigger a "oh-no" reaction ;) I also noticed on the stacktrace that the loop was being called from loop(), but I couldn't see why. So I was always a bit unsure about the added value of the stacktrace. @s0170071 I don't think it is cleared, since some things survive a reboot. |
"They" was me. And I did not enable anything other than that display. At least not that I am aware of.... |
ah ok sorry. was hoping it was the same underlying issue. :) |
ok we fixed some issues that might be related. can you try again? the next nightly v2.0 release should have the fixes. if its still not fixed let me know. i'll also try to reproduce it with http and the ds18 here. (will add it to the automated test suite) |
As described in letscontrolit#673 . The problem was partly related to the default values stored in flash ("0"), which was not a valid value for the switch type. When upgrading from an older version of ESPeasy, make sure to check the switch type (normal switch or dimmer) and save the settings for the switch device again, even when nothing was changed. Default configuration and new added switches will now work like intended. When a controller is enabled (e.g. Domoticz MQTT or -HTTP) and the button is pressed multiple times, the ESP may reboot. See issue letscontrolit#674.
* [switch] Fixed switch behavior and default settings. (#675) As described in #673 . The problem was partly related to the default values stored in flash ("0"), which was not a valid value for the switch type. When upgrading from an older version of ESPeasy, make sure to check the switch type (normal switch or dimmer) and save the settings for the switch device again, even when nothing was changed. Default configuration and new added switches will now work like intended. When a controller is enabled (e.g. Domoticz MQTT or -HTTP) and the button is pressed multiple times, the ESP may reboot. See issue #674. * ABC calibration feature added (#606) * [Flash info] Detailed flash information (#678) Last few days a number of issues and forum topic was about the type of flash used on the ESP boards. This is an extension of the detailed information page. Perhaps also merge with the newer and more clear layout of pull request #624? That pull request was only merged to the mega branch. I kept the changes local, but perhaps they should be placed in the "Storage" section introduced with #624. Maybe also that pull request should get merged into the v2.0 branch. * Bugfix/v2.0 crash switch (#682) * [crashes] Added constructors to initialize all members in structs Numerous structs are defined, but none of them have default constructors and there is no guarantee the members will be set when used. With these default constructors, the parameters at least have an initialized value. * [PubSubClient] Add bound checks on the internal buffer Not sure if this was really causing an issue, but proper bound checks are always a good thing. * [Crash Switch] Disabled delayBackground and added yield() calls Something really fishy is going on with the delayBackground function, which will result in crashes when pressing the switch multiple times, with Domoticz MQTT enabled as first controller. Disabled for now and delay(1) added to give background tasks a chance to do their work and make sure the watchdog doesn't perform a reset. * [CI build errors] Commented out some unused variables Travis considers them as error and fails the checks. * [CI check] Out-of-bounds check fix * actually ignore MQTT messages that are too big. * moved mqtt stuff outside of backgroundtasks(). fixes #683 in my test scenario * [Adafruit MPR121] Change deprecated name setThreshholds to setThresholds (#685) See #684 * fixed plugin id of "Communication - Kamstrup Multical 401". (accidental octal notation) * changed devicecombobox handling to save a lot of memory on device page. fixes #654 #676 and could be triggered by #683 in some cases. * [CPPcheck] v2.0 ControllerSettingsStruct some variables not initialized (#692) Fixing these cppcheck errors: 101.43s$ cppcheck --enable=warning src/*.ino -q --force -I src --include=src/ESPEasy.ino --error-exitcode=1 [src/ESPEasy.ino:500]: (warning) Member variable 'ControllerSettingsStruct::HostName' is not initialized in the constructor. [src/ESPEasy.ino:500]: (warning) Member variable 'ControllerSettingsStruct::Publish' is not initialized in the constructor. [src/ESPEasy.ino:500]: (warning) Member variable 'ControllerSettingsStruct::Subscribe' is not initialized in the constructor.
should be fixed now, please check tonights nightly's |
I recently update a nodemcu from R147 (which is working for 1 year) to v2.0.0-dev12 then to v2.0.0-dev13 but the result is the same :
I setup a controller (domoticz)
I setup a ds18B20 device (set 12 bits resolution, idx set, ... )
https://www.letscontrolit.com/forum/viewtopic.php?f=6&t=3959
no issue it is working well, but if I checked Send to Controller, then the nodemcu is rebooting randomly , I also check with a weemo D1 mini it is the same !
for the moment, I use this counter measure (by rules), and it is working well without random reboot:
//when temp is updated from device setup page on temp#Temperature do SendToHTTP 192.168.1.4,8080,/json.htm?param=udevice&type=command&idx=510&nvalue=0&svalue=[temp#Temperature] endon
The text was updated successfully, but these errors were encountered: