amg0 / ALTUI

Enhancement Interface for VERA home automation system
16 stars 8 forks source link

Possible Lua Startup bug while AltUI is pending an upgrade #31

Closed kapstaad closed 4 years ago

kapstaad commented 4 years ago

Vera3, FW 1.7.4453, AltUI 2.45.2528 (now).

I have periodically seen my Vera stop running my custom Lua scripts, and when opening the Vera UI top-level page, seen a blue bar at the top saying "Error in Lua for scenes and events". These scripts are years old, well-debugged, and have been extremely reliable, except for this occasional glitch.

This morning, my Vera failed to run my "wake up" scene correctly upon the relevant motion-detector sequences being triggered. I logged into the VeraUI to investigate, and sure enough, the message about Lua errors was present.

I checked my startup logs, and the only error logged during the startup sequence was: ''' 01 11/24/19 12:22:25.001 LuaInterface::StartEngine failed run: 0 attempt to call a string value <0x6e6b3520> 01 11/24/19 12:22:25.001 JobHandler_LuaUPnP::RunLua failed: local altui_device = 6

    local printResult = {}
    local function myPrint (...)
            local arg = {}

'''

I launched AltUI, and was immediately presented with an option to update to a newer version. At this point I realized that I've also seen an "update to AltUI" message when I had previously encountered the Lua error...

I tried a soft restart of Vera, to no avail. I then tried POPO reset, also to no avail.

So I launched AltUI again, and approved the update to the latest version. After updating AltUI, Vera restarted itself... and the Lua error message was gone, and my scripts all began executing normally again.

I realize that correlation ~= causation, however there does seem to be a consistent pattern here. Is it possible that AltUI is doing something upon detecting that an update is available, that could triggering this Lua error?

amg0 commented 4 years ago

the ALTUI startup error you see is due to the Lua load error. it is the consequence , not the cause. the ALTUI update detection is totally client side driven (javascript in the browser ) so has no bearing on this issue.

I have seen many lua startup error in VERA especially when using scheduled timer to run scene, vera sometimes try to fire some scene while the luup startup has not finished and this cause this kind of issues.