Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2022-01-25 17:05:55



Reply to topic  [ 12 posts ]  Go to page 1, 2  Next
Crash sometimes when using Lua CallbackAfter() 
Author Message
Online

Joined: 2016-06-19 21:33:37
Posts: 242
Location: San Francisco bay area, CA, USA
Reply with quote
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:
Code:
com.secondlife.indra.viewer 0xe638ad HBViewerAutomation::doAfterIntervalCallback(lua_State*, int) + 509


My info as reported by the viewer is:
Code:
Cool VL Viewer v1.26.20.18, 64 bits, Apr 22 2017 09:39:51
Release Notes

CPU: AMD A4-7300 APU with Radeon HD Graphics (3800 MHz)
Memory: 16072MB
OS version: Linux-x86_64 v4.10.10-200.fc25.x86_64 #1 SMP Thu Apr 13 01:11:51 UTC 2017
Memory manager: OS native
Graphics card vendor: NVIDIA Corporation
Graphics card: GeForce GTS 450/PCIe/SSE2
OpenGL version: 4.5.0 NVIDIA 375.39
Detected VRAM: 1024MB
J2C decoder: OpenJPEG: 1.4.0.635d
Audio driver: OpenAL v1.1 ALSOFT 1.17.2 (OpenAL Soft: OpenAL Soft)
Networking backend: libcurl/7.47.0 OpenSSL/1.0.1i zlib/1.2.8
Embedded browser: CEF3 plugin v1.5.3c-(CEF-LIN-3.2526.1371-64)

Built with: GCC v4.6.4

Compile flags used for this build:
-O3 -fno-delete-null-pointer-checks -fno-align-labels -fno-align-loops -fno-ipa-cp-clone -fsched-pressure -frename-registers -fweb -DNDEBUG -pipe -g -fexceptions -fno-strict-aliasing -fvisibility=hidden -fsigned-char -m64 -mfpmath=sse -fno-math-errno -fno-trapping-math -pthread -fno-stack-protector -Wall -Wno-reorder -Werror -DLL_LINUX=1 -D_REENTRANT -DXML_STATIC -DLL_ELFBIN=1 -DLL_LUA=1 -DOV_EXCLUDE_STATIC_CALLBACKS -DLL_FMODEX=1 -DLL_OPENAL=1 -DLL_SDL=1 -DLIB_NDOF=1 -DLL_X11=1


I am also attaching my CoolVLViewer.log and the stack_trace.log.


Attachments:
crash_logs.zip [25.6 KiB]
Downloaded 103 times
2017-04-22 20:07:23
Profile

Joined: 2009-03-17 18:42:51
Posts: 4809
Reply with quote
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
Profile WWW
Online

Joined: 2016-06-19 21:33:37
Posts: 242
Location: San Francisco bay area, CA, USA
Reply with quote
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.


Attachments:
automation.zip [9.71 KiB]
Downloaded 117 times
2017-04-23 00:33:01
Profile
Online

Joined: 2016-06-19 21:33:37
Posts: 242
Location: San Francisco bay area, CA, USA
Reply with quote
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.


Attachments:
crash_logs_2.zip [30.3 KiB]
Downloaded 111 times
2017-04-23 00:47:53
Profile

Joined: 2009-03-17 18:42:51
Posts: 4809
Reply with quote
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
Profile WWW
Online

Joined: 2016-06-19 21:33:37
Posts: 242
Location: San Francisco bay area, CA, USA
Reply with quote
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
Profile
Online

Joined: 2016-06-19 21:33:37
Posts: 242
Location: San Francisco bay area, CA, USA
Reply with quote
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:
Code:
2017-04-23T17:38:16Z DEBUG: HBViewerAutomation::onLuaPieMenu: Invoking OnLuaPieMenu Lua callback.
2017-04-23T17:38:16Z DEBUG: HBViewerAutomation::callbackAfter: Queuing Lua callback with reference: 3 - Number function arguments: 3
2017-04-23T17:38:17Z DEBUG: HBViewerAutomation::doAfterIntervalCallback: Invoking Lua callback associated with reference: 3
2017-04-23T17:38:17Z DEBUG: HBViewerAutomation::doAfterIntervalCallback: Number function arguments: 3


Attachments:
crash_logs_3.zip [24.48 KiB]
Downloaded 102 times
2017-04-23 17:43:20
Profile

Joined: 2009-03-17 18:42:51
Posts: 4809
Reply with quote
In fact, the problem might be with:

Code:
2017-04-23T17:38:11Z WARNING: HBViewerAutomation::onSendChat: Non-string result returned by OnSendChat() Lua callback

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
Profile WWW
Online

Joined: 2016-06-19 21:33:37
Posts: 242
Location: San Francisco bay area, CA, USA
Reply with quote
Henri Beauchamp wrote:
Your OnSendChat() lacks a 'return text' statement, at the end
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
Profile
Online

Joined: 2016-06-19 21:33:37
Posts: 242
Location: San Francisco bay area, CA, USA
Reply with quote
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
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.