Author |
Message |
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 337 Location: Columbus area, OH, USA
|
I am using the Lua CallbackAfter() function in a few places in my automation.lua(c). Most of the time things perform as expected but I have had a few crashes this morning and finally decided to capture the logs and post a topic about it. The only reason I am suspecting the callback is this line from the stack_trace.log: My info as reported by the viewer is: I am also attaching my CoolVLViewer.log and the stack_trace.log.
|
2017-04-22 20:07:23 |
|
|
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5523
|
That's pretty weird... I've been using the viewer several days with dozens of such calls every session, and never crashed. I'd need the Lua script to try and reproduce your issue.
|
2017-04-22 23:36:18 |
|
|
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 337 Location: Columbus area, OH, USA
|
I can certainly provide but it's rather large and may not be intuitive in the functions/behaviors I have added. It's documented sparsely at each function level though. I have been trying to replicate the issue with a simple .lua file to no avail. In it I run repeated callbacks triggered by an OnSendChat() with no issues. And with my original, I can't reliably reproduce it but when it does happen, the stack appears to be the same each time. I'm attaching a .zip of my script in 'combined' form. In actuality, I keep multiple files that are basically cat'd together and then compiled with luac. And as a note, I am using a custom skin on panel_lua_sidebar.xml to have more than 12 sidebar buttons.
|
2017-04-23 00:33:01 |
|
|
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 337 Location: Columbus area, OH, USA
|
Here is a second set of logs. Another crash happened right after I posted the previous message. I don't expect they will help, but you never know.
|
2017-04-23 00:47:53 |
|
|
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5523
|
Could you please enable the "Lua" debug tag in your sessions (Advanced -> Consoles -> Debug tags) so that we get more info in the log, when you will crash again ?
I suspect a Lua bug (apparently, it's the stored reference to the callback parameters that somehow gets lost), but I need confirmation via the log, since I could not reproduce the issue so far.
|
2017-04-23 09:12:39 |
|
|
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 337 Location: Columbus area, OH, USA
|
Yes, I will do that. Unfortunately, no crashes yet this morning. 'Smells' a little like some kind of race condition perhaps. I'll post my next crash logs with the Lua Debug tags enabled.
|
2017-04-23 14:23:52 |
|
|
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 337 Location: Columbus area, OH, USA
|
Well, crash achieved. I'm attaching the new logs though they don't seem to have much additional DEBUG info. It looks like the relevant bits might be:
|
2017-04-23 17:43:20 |
|
|
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5523
|
In fact, the problem might be with: Your OnSendChat() lacks a 'return text' statement, at the end, which could possibly corrupt the Lua stack and explain this weird crash later on... Please add the statement, and see what happens. If it is indeed the problem, I'll make the Lua script stop instead of just issuing a warning, in next release.
|
2017-04-23 22:48:12 |
|
|
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 337 Location: Columbus area, OH, USA
|
Doh! I wonder why I didn't notice that before? I have not had any trouble 'sending text' through the viewer and having others receive it with out a return. I appreciate you reviewing my 'massive' script and suggesting that. I'm adding a proper return now.
|
2017-04-23 23:15:09 |
|
|
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 337 Location: Columbus area, OH, USA
|
I can't be certain, obviously, but I have not had a crash since I refactored my OnSendChat() callback to always ensure a return value. I must have, over the course of time and rework, omitted the return from one of my conditionals. I suspect it was when I was improving the check for a command just by doing a single find for the slash as opposed to trying to find each command, one after the other. I'll update this message thread if anything changes, but I think you were spot on with your diagnosis.
|
2017-04-24 02:36:15 |
|
|