Author Topic: Help debugging "ERROR : Error in lua for scenes and events"  (Read 3196 times)

Offline ih8gates

  • Full Member
  • ***
  • Posts: 207
  • Karma: +8/-1
Help debugging "ERROR : Error in lua for scenes and events"
« on: November 07, 2013, 09:37:31 am »
I made a lot of changes yesterday. I'm working on more this morning. I just started getting the "ERROR : Error in lua for scenes and events" message. Is there a way to spot where the code is that's causing the error? When I look at my logs, I can see:

LuaInterface::StartEngine failed run: 0 attempt to call a string value

followed by the Lua for my various scenes. It always cuts off (stops displaying scene function() code) in the same place. But I've inspected the code in that scene and it looks good (and works in the Lua tester). In the log, I see this on the last line of the echo of Lua in the log

function scen __LEAK__ this:24576 start:3248128 to 0x1a37000 <0x2bf4f680>


I've copied all of the scene functions that are echoed into the log and run them through the Lua tester, too.

Is there a reliable way to isolate where the failing code lives?

Offline ih8gates

  • Full Member
  • ***
  • Posts: 207
  • Karma: +8/-1
Re: Help debugging "ERROR : Error in lua for scenes and events"
« Reply #1 on: November 07, 2013, 09:49:38 am »
FRUSTRATING!

I rebooted and the error has gone away.

My original question still stands, though - when I get that error, I generally look to the current code I'm working on. But what if the error lies elsewhere?

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 10091
  • Karma: +763/-142
Re: Help debugging "ERROR : Error in lua for scenes and events"
« Reply #2 on: November 08, 2013, 06:29:31 pm »
Test all of your LUA in a standalone LUA environment.
Only after it works move it to Vera.
It's to painful to debug on Vera.
There are many threads about LUA environments in this forum.

Offline ih8gates

  • Full Member
  • ***
  • Posts: 207
  • Karma: +8/-1
Re: Help debugging "ERROR : Error in lua for scenes and events"
« Reply #3 on: November 09, 2013, 06:12:24 am »
So, it sounds like once I've got the error, it's too late. Prevention is the way to go.

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 10091
  • Karma: +763/-142
Re: Help debugging "ERROR : Error in lua for scenes and events"
« Reply #4 on: November 09, 2013, 06:48:03 am »
Depending on where the LUA is (Startup LUA, Trigger or Scene LUA, Plugin LUA) .. there are different ways to debug. Also depends on how bad the error is.

But it's much more productive to eliminate syntax/logic errors outside of Vera.

Offline AgileHumor

  • Hero Member
  • *****
  • Posts: 984
  • Karma: +51/-27
  • KISS
Re: Help debugging "ERROR : Error in lua for scenes and events"
« Reply #5 on: March 08, 2014, 12:55:30 pm »
I get this error on one out of 100 reloads.  A reboot always fixes the issue.

Weird things happen when the unit is in this state.   For example, "luup.is_night" and  "not luup.is_night()" both return true...so conditional Luup scene filtering doesn't work.

Is there anything I can do to detect the "ERROR : Error in lua for scenes and events" condition in my startup LUA?
WMC Leviton:18xVPE06,8xVRS15,3xVRP03-W,2xVRR15,4xVRCS4,2xVRCS2,VP00R,8xVRS15 Aeon:5xDSC06106,4xDSC24,4xDSC25,12xDSB29,2xDSC11,4xDSB54,DSB05,3xDSA22,DSA38,2xDSA03202B,DSB09104,HEM Other:3xYale,12xHSM100v3,7xSP103,45604,WDHA-12,SSA2USR,EVLCD1T,6xWWA02A,7xIPC-HFW2100,URTSI,Hue,Russound,OpenSprinker

Offline litening

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Re: Help debugging "ERROR : Error in lua for scenes and events"
« Reply #6 on: April 01, 2016, 07:49:47 am »
I get this (very annoying) problem when I have scenes with lua that are on a scheduled interval (once a minute for example). Happens sporadically at startup.

By removing all scenes that where on scheduled intervals I got a stable installation again.

In my startup Lua i have defined a bunch of functions, not sure if this is related to that.

Offline ricciolo

  • Newbie
  • *
  • Posts: 17
  • Karma: +1/-0
Re: Help debugging "ERROR : Error in lua for scenes and events"
« Reply #7 on: November 29, 2017, 04:54:07 pm »
Did anyone understand which is the cause of this issue? I've the same behavior  :'(

Offline rafale77

  • Hero Member
  • *****
  • Posts: 1235
  • Karma: +62/-23
Re: Help debugging "ERROR : Error in lua for scenes and events"
« Reply #8 on: November 30, 2017, 04:08:55 pm »
Did anyone understand which is the cause of this issue? I've the same behavior  :'(

I have been living with this for many years: Random "Error in lua for scenes and events or startup lua". I think it is related to timing and slow processing of the CPU which randomly does not have all the codes ready during a luup reload or boot up. I noticed that it gets worse as the startup LUA size, the plugin count and the scene count increases.

I am gradually migrating to Openluup and eventually hoping to use the vera only as a Zwave and zigbee bridge without automation and only minimal plugins.
« Last Edit: November 30, 2017, 04:11:08 pm by rafale77 »
openLuup (97 devices, 134 scenes, 20 apps) controlling HomeAss + VeraPlus (138 zwave nodes, 8 Zigbee nodes, 205 devices, 20 scenes , 2 app) Bridged to Homekit and Alexa. VeraPlus ExtRooted!

Offline ricciolo

  • Newbie
  • *
  • Posts: 17
  • Karma: +1/-0
Re: Help debugging "ERROR : Error in lua for scenes and events"
« Reply #9 on: December 18, 2017, 04:20:03 am »
Same here and Vera support can't help since the issue is hard to reproduce :-(