Razish / japp

JA++ server and client modification for Jedi Academy
GNU General Public License v2.0
44 stars 30 forks source link

Serverside Serialiser crash #102

Closed Exmirai closed 10 years ago

Exmirai commented 10 years ago

CRASH LOG:

----------------------------------------
          Disassembly/Source code
----------------------------------------
Crash location located at 0x58452817: jampgamex86.dll::cJSON_GetObjectItem(+0x27) [Func at 0x584527F0]
Source code: d:\jk source\japp-master\json\cjson.c:856(+0x9)

^^^^^^^^^^

--- d:\jk source\japp-master\json\cjson.c:853(+0x9) ---

0x584527F9 - push ebx                      
0x584527FA - push esi                      
0x584527FB - push edi                      
0x584527FC - lea edi, [ebp-0xd8]           
0x58452802 - mov ecx, 0x36                 
0x58452807 - mov eax, 0xcccccccc           
0x5845280C - rep stosd                     

--- d:\jk source\japp-master\json\cjson.c:856 ---

0x5845280E - cmp dword ptr [ebp+0x8], 0x0  
0x58452812 - jz 0x5845281d                 
0x58452814 - mov eax, [ebp+0x8]            

=============================================
0x58452817 - cmp dword ptr [eax+0x18], 0x6  <-- Exception
=============================================

0x5845281B - jz 0x58452821                 

--- d:\jk source\japp-master\json\cjson.c:857 ---

0x5845281D - xor eax, eax                  
0x5845281F - jmp 0x58452872                

--- d:\jk source\japp-master\json\cjson.c:860 ---

0x58452821 - push 0x20                     
0x58452823 - mov eax, [ebp+0xc]            
0x58452826 - push eax                      
0x58452827 - call 0x584529e0                (cJSON_GenerateHashValue)
0x5845282C - add esp, 0x8                  
0x5845282F - mov [ebp-0x14], eax           

--- d:\jk source\japp-master\json\cjson.c:861 ---

0x58452832 - mov eax, [ebp+0x8]            
vvvvvvvvvv

----------------------------------------
                Backtrace
----------------------------------------
jampgamex86.dll::cJSON_GetObjectItem(+0x27) [0x58452817] - (d:\jk source\japp-master\json\cjson.c:856)
jampgamex86.dll::JPLua_Serialiser_IterateTableRead(+0x5F) [0x5852FB3F] - (d:\jk source\japp-master\game\g_luaserialiser.c:98)
jampgamex86.dll::JPLua_Serialiser_GetTable(+0x93) [0x5852FFD3] - (d:\jk source\japp-master\game\g_luaserialiser.c:189)
jampgamex86.dll::luaD_precall(+0x178) [0x5864CAF8] - (d:\jk source\japp-master\lua\ldo.c:319)
jampgamex86.dll::luaV_execute(+0x1904) [0x58656C24] - (d:\jk source\japp-master\lua\lvm.c:722)
jampgamex86.dll::luaD_call(+0xBF) [0x5864D39F] - (d:\jk source\japp-master\lua\ldo.c:402)
jampgamex86.dll::f_call(+0x3C) [0x58642A2C] - (d:\jk source\japp-master\lua\lapi.c:923)
jampgamex86.dll::luaD_rawrunprotected(+0x6B) [0x5864C27B] - (d:\jk source\japp-master\lua\ldo.c:133)
jampgamex86.dll::luaD_pcall(+0x5E) [0x5864DE2E] - (d:\jk source\japp-master\lua\ldo.c:603)
jampgamex86.dll::lua_pcallk(+0x98) [0x58642878] - (d:\jk source\japp-master\lua\lapi.c:949)
jampgamex86.dll::JPLua_LoadFile(+0xD9) [0x58528569] - (d:\jk source\japp-master\game\g_lua.c:86)
jampgamex86.dll::JPLua_LoadPlugin(+0xED) [0x5852ACBD] - (d:\jk source\japp-master\game\g_lua.c:428)
jampgamex86.dll::JPLua_PostInit(+0x314) [0x5852AA24] - (d:\jk source\japp-master\game\g_lua.c:474)
jampgamex86.dll::JPLua_Init(+0x40A) [0x5852A38A] - (d:\jk source\japp-master\game\g_lua.c:550)
jampgamex86.dll::G_InitGame(+0x7DA) [0x58531A4A] - (d:\jk source\japp-master\game\g_main.c:525)
openjkded.x86.exe::GVM_InitGame(+0x51) [0x004C2301] - (d:\jk source\openjk-rend2\codemp\server\sv_gameapi.cpp:33)
openjkded.x86.exe::SV_InitGame(+0x84) [0x004C8C84] - (d:\jk source\openjk-rend2\codemp\server\sv_gameapi.cpp:2880)
openjkded.x86.exe::SV_InitGameProgs(+0x62) [0x004B6E22] - (d:\jk source\openjk-rend2\codemp\server\sv_game.cpp:121)
openjkded.x86.exe::SV_SpawnServer(+0x38D) [0x004B7D7D] - (d:\jk source\openjk-rend2\codemp\server\sv_init.cpp:595)
openjkded.x86.exe::SV_Map_f(+0x1B8) [0x004B0A78] - (d:\jk source\openjk-rend2\codemp\server\sv_ccmds.cpp:201)
openjkded.x86.exe::Cmd_ExecuteString(+0xA0) [0x003CAA80] - (d:\jk source\openjk-rend2\codemp\qcommon\cmd_pc.cpp:152)
openjkded.x86.exe::Cbuf_Execute(+0x25D) [0x003C9AED] - (d:\jk source\openjk-rend2\codemp\qcommon\cmd_common.cpp:228)
openjkded.x86.exe::Com_Frame(+0x155) [0x003CDAC5] - (d:\jk source\openjk-rend2\codemp\qcommon\common.cpp:1536)
openjkded.x86.exe::main(+0x1A1) [0x0057A0F1] - (d:\jk source\openjk-rend2\codemp\win32\win_main_ded.cpp:1066)
openjkded.x86.exe::__tmainCRTStartup(+0x1BF) [0x005C7A8F] - (f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:555)
openjkded.x86.exe::mainCRTStartup(+0xF) [0x005C78BF] - (f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:371)
kernel32.dll::BaseThreadInitThunk(+0x12) [0x7642336A]
ntdll.dll::RtlInitializeExceptionChain(+0x63) [0x77C49F72]
ntdll.dll::RtlInitializeExceptionChain(+0x36) [0x77C49F45]

----------------------------------------
            Extra Information
----------------------------------------
----------------------------------------
          Server info / players
----------------------------------------
Map: mp/ffa3

Players: 0/8:

========================================
             End of crash log
========================================

Part of Code:

function BanSys.SaveData()
    local data = GetSerialiser('admin/bandata.dat', FSMode.WRITE)
        local t = BanSys.Bans
        local z = 'Ban'
        data:addTable( z, t)
end
Razish commented 10 years ago

That doesn't seem to be the part that's crashing. It's crashing from a ReadTable call.

In any case, can you try running this?

function display( t, indent )
    local s = ''
    for k,v in pairs( t ) do
        for i=0,indent do
            s = s .. '\t'
        end
        s = s .. k .. ' (' .. type( k ) .. ')' .. ': ' .. ((type( v ) == 'table') and (' (table)\n' .. display( v, indent+1 )) or (tostring( v )) .. ' (' .. type( v ) .. ')' ) .. '\n'
    end
    return s .. '\n'
end

function BanSys.SaveData()
    local sr = GetSerialiser( 'admin/bandata.dat', FSMode.WRITE )
    local t = BanSys.Bans
    local z = 'Ban'
    print( 'writing test:\n' )
    print( display( t, 0 ) )
--  sr:AddTable( z, t )
--  sr:Close()
--  sr = nil
end
Exmirai commented 10 years ago

yes, that executed perfectly

Razish commented 10 years ago

What did it show? =p

Exmirai commented 10 years ago

1 : lal 2 : lol

tables : BanSys = { Bans = {"lal", "lol"} }

Razish commented 10 years ago

Serialising the above table worked fine for me on client and server.

Exmirai commented 10 years ago

ok, that work now... but there is another problem: my "Plugin" use modules ( bansys.lua, accounts.lua etc... ) so when i'm start server or type /lua_reload Server load tables from /japlus/sv/plugin name/admins.data. but, when i'm trying to save data manually by BanSys.Save() ( this function is in Bansys.lua ) then server saves file in /japlus/sv/(NULL)/admins.data why so? :( how to fix?

Razish commented 10 years ago

How are you running Bansys.lua?

Exmirai commented 10 years ago

in plugin.lua : function Init () require 'BanSys.lua' local test = BanSys.LoadData if not test then print("ERROR") else BanSys.LoadData() end end

Razish commented 10 years ago

Looks like you haven't registered the plugin? Try that in plugin.lua

Exmirai commented 10 years ago

if i put function in plugin.lua it works perfecly but i want that function was in BanSys.lua

Razish commented 10 years ago

Are you using require after the call to RegisterPlugin?

Exmirai commented 10 years ago

yea, can i send to you part of code for analysis, it will be much easier,

Exmirai commented 10 years ago

https://www.dropbox.com/s/yfx0iaedt3hptj8/Elib2.zip - Some parts of code