crash

crash

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

Post Reply
aragon
Posts: 14
Joined: 20 Jan 2008, 13:44

crash

Post by aragon »

every time i do /luaui reload, my spring crashes (tested on singleplayer)
Core 2 Duo 2.4
1.5GB ram
GeForce 7600GS

i removed all widgets from LuaUI/widgets and it still crashes
it happens only with BA6.1 (so, it is also BA bug, but it should not crash spring probably, just luaui)

here is infolog:
http://pastebin.com/f7bc4e9c9
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Re: crash

Post by NOiZE »

Seems to happen for me too, it seems its related to the BA layout widget, which lurker made, maybe lurker can take a look?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: crash

Post by lurker »

Is your luaui/main.lua 4332 bytes?
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Re: crash

Post by NOiZE »

lurker wrote:Is your luaui/main.lua 4332 bytes?
yes
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: crash

Post by lurker »

not you >_>
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Re: crash

Post by NOiZE »

i get the same crash.... when i do /luaui reload with BA61 and my infolog says the same then.
eriatarka
Posts: 67
Joined: 26 Jan 2008, 18:50

Re: crash

Post by eriatarka »

I fed it to the stacktrace translator:

http://pastebin.com/m5da1ce0d

EDIT: From the length and structure of this thing, I'd say a stack overflow from some infinite recursion.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: crash

Post by lurker »

NOiZE wrote:i get the same crash.... when i do /luaui reload with BA61 and my infolog says the same then.
Do you also get the:


LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Re: crash

Post by NOiZE »

yes
Attachments
crashinfolog.txt
(36.59 KiB) Downloaded 111 times
aragon
Posts: 14
Joined: 20 Jan 2008, 13:44

Re: crash

Post by aragon »

yes, my main.lua is exactly 4332 bytes long
eriatarka
Posts: 67
Joined: 26 Jan 2008, 18:50

Re: crash

Post by eriatarka »

I've finally tracked down this elusive little bugger (BTW with the help of the Lua trace script I posted in the Lua section, very helpful).

It's a bit complicated, so bear with me. What happens when the UI is reloaded is this:
  • The Lua context is torn down and re-initialized from scratch.
  • The LuaUI widget manager initializes itself and runs each widget's Initialize method.
  • The BA Layout widget's Initialize method invokes the console command "/ctrlpanel" with the mod's custom ctrlpanel.txt, which in turn calls CGuiHandler::ReloadConfig.
  • ReloadConfig calls LayoutIcons, which eventually does a Lua callin for LayoutButtons.
  • At this point, the BA widget hasn't yet registered its LayoutButtons replacement function, so the default LuaUI handler is called.
  • This handler, DefaultHandler in layout.lua, tries to access the global variable activePage, which hasn't been set at this point. We get an error.
  • The callin function catches the error and tries to shutdown LuaUI.
  • LuaUI calls each widget's Shutdown method.
  • The BA layout widget, in its Shutdown method, again issues a /ctrlpanel command to reset to default settings. Back to step 4.
And there you have it, infinite recursion with an eventual stack overflow. So, it's a LuaUI bug and not Lurker's fault.

The fix is easy, a one-liner in fact: change layout.lua to read

Code: Select all

  if (xIcons > 2) then
    local color
    if (commands[1].id < 0) then color = GreenStr else color = RedStr end
    local activePage = activePage or 0         -- <- this is the line to be added --
    local pageNum = '' .. (activePage + 1) .. ''
    PageNumCmd.name = color .. '   ' .. pageNum .. '   '
    table.insert(customCmds, PageNumCmd)
    pageNumCmd = cmdCount + 1
  end
Unfortunately I don't have SVN access.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: crash

Post by Kloot »

Thanks for the nice detective work, it's committed.
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Re: crash

Post by LordMatt »

Did you verify that this bug/fix works with the latest SVN version? If so, I can commit this for you.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Re: crash

Post by NOiZE »

so i assume i need to add that in the BA layout widget as well?
eriatarka
Posts: 67
Joined: 26 Jan 2008, 18:50

Re: crash

Post by eriatarka »

NOiZE wrote:so i assume i need to add that in the BA layout widget as well?
It's not really necessary; as I said, the custom handler hasn't been installed at the time the crash occurs. However it's certainly not bad practice.
User avatar
Acidd_UK
Posts: 963
Joined: 23 Apr 2006, 02:15

Re: crash

Post by Acidd_UK »

MASSIVE Thankyou for fixing this - this problem has been plaguing me since the release!
Post Reply

Return to “Help & Bugs”