Skip to content
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 in determine index of Plugin_ptr #2676

Closed
TD-er opened this issue Oct 21, 2019 · 5 comments · Fixed by #2667
Closed

Bug in determine index of Plugin_ptr #2676

TD-er opened this issue Oct 21, 2019 · 5 comments · Fixed by #2667
Labels
Category: Stabiliy Things that work, but not as long as desired Type: Bug Considered a bug

Comments

@TD-er
Copy link
Member

TD-er commented Oct 21, 2019

Found a very, very serious bug in the __Plugin.ino code and it looks like I introduced it around 20180705. See: 2fde3d2

Problem is in the handling of some functions like PLUGIN_xxx (WRITE/READ/etc)
It is then using the wrong index to do stuff, which may yield strange results on builds with not all plugins included (mainly test and custom)

Impact is a bit hard to predict, but I guess it may lead to strange crashes.
That's also around the time when WDT reboots started to be reported.
So when fixed, it may hopefully fix a number of issues.

Plugin_ptr will only use indices based on the number of plugins included in the build.
So it must be addressed using an index based on the DeviceIndex (not sure if that's the right index) and not on the plugin ID number (e.g. 004 for Dallas sensor)

@TD-er TD-er added Category: Stabiliy Things that work, but not as long as desired Type: Bug Considered a bug labels Oct 21, 2019
@TD-er TD-er added this to To do in Release Mega via automation Oct 21, 2019
@TD-er TD-er added this to Needs triage in Improve Stability via automation Oct 21, 2019
@TD-er TD-er moved this from To do to In progress in Release Mega Oct 21, 2019
@TD-er TD-er moved this from Needs triage to High priority in Improve Stability Oct 21, 2019
@TD-er TD-er added this to Misc in PRIO list Oct 21, 2019
@ghtester
Copy link

ghtester commented Oct 22, 2019

So perhaps that's why I experienced a device change from IRTX to Switch recently after replacing the ESP_Easy firmware with custom build without IRTX plugin while keeping the config... :-)
Great job, Gijs, that you found this bug!

@TD-er
Copy link
Member Author

TD-er commented Oct 22, 2019

The bug appears to be quite old, so not sure what big jump you made in versions?

Also I am already working on some refactoring of the code to make the naming of variables a bit more descriptive since I also got rather confused by them.
Maybe the bug is a bit less serious, but still it should be clear what the code does and the current code is really not clear.

TD-er added a commit to TD-er/ESPEasy that referenced this issue Oct 22, 2019
…#2676)

See letscontrolit#2676
The use of DeviceIndex was not consistent, which may lead to strange issues.
DeviceIndex is the translation between the vector of included plugins and IDs of plugins available.
@ghtester
Copy link

ghtester commented Oct 22, 2019

Well, the config was very old and a many firmware upgrades performed during last 2 years on that node... In past both IRRX and IRTX were in std or test official builds but it's not the case anymore so I had to start with custom builds using Vagrant (btw. many thanks for preparing that great environment!). As I need a lot of plugins and the current IRRX and IRTX plugins are so big, I disabled the IRTX as IRRX is more important for me but the config remained the same when I uploaded the customized firmware to node. Then the IRTX (device 11) changed to Switch.

@TD-er
Copy link
Member Author

TD-er commented Oct 23, 2019

Yep, if a plugin cannot be found, it will set it to the first one.
That's also a bug, which I may be able to fix with these changes.

The size of IR plugins is what made me decide to move them to a separate build.
But like you also found out, you cannot have a 1-build-fits-all, so that's why I was looking into the Vagrant setup.

@TD-er
Copy link
Member Author

TD-er commented Oct 23, 2019

Also fixing a long lasting annoyance along the way.
If a task is set to a pluginID not included in the current build, it was showing "Switch" as plugin.
Also it was not really clear what would happen if you then edit the page.

This is how it will look after this has been fixed:

image

The plugin ID will be shown and the name. Enabled state will be shown as disabled and the rest will be left empty.
While typing this, I realize the red button should show "Add" or maybe some other text indicating you will create a new entry when pressing the button.

Release Mega automation moved this from In progress to Done Oct 27, 2019
Improve Stability automation moved this from High priority to Closed Oct 27, 2019
PRIO list automation moved this from Misc to Done Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Stabiliy Things that work, but not as long as desired Type: Bug Considered a bug
Projects
PRIO list
  
Done
Release Mega
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants