ewnavilae / gmodmodules

Automatically exported from code.google.com/p/gmodmodules
0 stars 0 forks source link

TMySQL Causing SRCDS Crash #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Joining the server, happens at random.

What is the expected output? What do you see instead?
See image attachment.

What version of the product are you using? On what operating system?
tmysql3 boost, windows 7 ultimate x64

Please provide any additional information below.

This didn't happen until I switched my code from MySQLOO. I do not get crash 
dumps.

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: srcds.exe
  Application Version:  0.0.0.0
  Application Timestamp:    4ea78f29
  Fault Module Name:    datacache.dll
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp:   4ee862f9
  Exception Code:   c0000005
  Exception Offset: 00001985
  OS Version:   6.1.7600.2.0.0.256.1
  Locale ID:    1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Original issue reported on code.google.com by luminous...@gmail.com on 19 Jan 2012 at 2:48

Attachments:

GoogleCodeExporter commented 8 years ago
I've refactored the result table code in r177. Try the new bins and out let me 
know if it helps:

http://code.google.com/p/gmodmodules/source/detail?r=177
http://gmodmodules.googlecode.com/svn-history/r177/trunk/gm_tmysql3_boost/Releas
e/gm_tmysql.dll

Original comment by AzuiSl...@gmail.com on 19 Jan 2012 at 11:24

GoogleCodeExporter commented 8 years ago
Made another small change. Try r178

http://code.google.com/p/gmodmodules/source/detail?r=178
http://gmodmodules.googlecode.com/svn-history/r178/trunk/gm_tmysql3_boost/Releas
e/gm_tmysql.dll

Original comment by AzuiSl...@gmail.com on 20 Jan 2012 at 12:37

GoogleCodeExporter commented 8 years ago
Still getting the same exact error, those changes did not seem to make a 
difference.

Original comment by luminous...@gmail.com on 20 Jan 2012 at 3:03

GoogleCodeExporter commented 8 years ago
I wasn't able to reproduce the crash with the code you gave me. You should 
check to make sure there aren't any conflicting modules or addons.

If it won't write a crash dump you should create a memory dump with the 32-bit 
taskmgr (Windows/syswow64/taskmgr) and email it to me.

Original comment by AzuiSl...@gmail.com on 20 Jan 2012 at 3:08

GoogleCodeExporter commented 8 years ago
Email should be on its way now. I've been trying to find a simple way to 
reproduce the problem and haven't had any luck yet. I was thinking maybe it had 
to do with the fact I was running new queries in the callback functions but I 
don't think thats it. Could running queries on GM:Initialize cause this? I load 
a lot of data from the database then but the callbacks don't run until a player 
joins the server.

Original comment by luminous...@gmail.com on 20 Jan 2012 at 3:44

GoogleCodeExporter commented 8 years ago
It looks like you sent me a 64-bit dump. Make sure you do the dump from the 
32-bit taskmgr in syswow64.

Neither of those cases should result in a crash. Here is a debug build with 
some console messages to see if it's a crash on free: 
http://dl.dropbox.com/u/759758/gm_tmysql_freedebug.zip

Original comment by AzuiSl...@gmail.com on 20 Jan 2012 at 4:18

GoogleCodeExporter commented 8 years ago
I found out my server was outdated today, I couldn't check yesterday because 
the content servers were not available. The only other module on the server is 
tmysl. I also emailed you a proper dump. I attached a screenshot of the results 
of the debug bin for you too.

Original comment by luminous...@gmail.com on 20 Jan 2012 at 7:32

Attachments:

GoogleCodeExporter commented 8 years ago
I found what is causing my server to crash. When I switched to TMySQL I decided 
to have my NPC's spawn when the callback function is triggered that loads the 
NPC's from the database. I figured since the callback wont trigger until 
someone joins the server that I could do it this way since the InitPostEntity 
would have already happened. Not sure if that makes sense to you, but it causes 
the server to crash when I spawn them. Whats your take on it lol?

<----CODE---->
function GM.CreateNPC(model,name,pos,angles,storeid)
    local npc = ents.Create("lprp_npc");
    npc:SetPos(pos);
    npc:SetAngles(angles);
    npc.Name = name;
    npc.StoreID = storeid;
    npc:Spawn();
    npc:SetModel(model);
    npc:Activate();
end

function GM.LoadNPCs()
    local GAMEMODE = GAMEMODE;
    print("Loading NPC's...");
    tmysql.query(Format("SELECT * FROM npcs WHERE Map=%q",game.GetMap()),function(res,status,error)
        if(status) then
            print(#res.." NPC's Loaded.");
        else
            GAMEMODE.MySQLLog(error);
            timer.Simple(0.1,GAMEMODE.LoadItems);
            return;
        end
        GAMEMODE.NPCData = res;
        for k,v in pairs(ents.FindByClass("lprp_npc")) do
            v:Remove();
        end
        GAMEMODE.SpawnNPCs();
    end,1);
end

function GM.SpawnNPCs()
    local GAMEMODE = GAMEMODE;
    for k,v in pairs(GAMEMODE.NPCData) do
        print("Created NPC "..v.Name);
        GAMEMODE.CreateNPC(v.Model,v.Name,Vector(v.X,v.Y,v.Z),Angle(0,v.Yaw,v.Roll),v.StoreID);
    end
end

Original comment by luminous...@gmail.com on 21 Jan 2012 at 4:45

GoogleCodeExporter commented 8 years ago
Also, if I lua_run the function after I join they spawn fine. Only happens when 
I run it through the callback.

Original comment by luminous...@gmail.com on 21 Jan 2012 at 4:51

GoogleCodeExporter commented 8 years ago
I'll take a look at this when I get a chance. It might be related to the other 
crashes people are having. Thanks for this test case.

Original comment by AzuiSl...@gmail.com on 21 Jan 2012 at 4:53

GoogleCodeExporter commented 8 years ago
Alright well I tried to reproduce with a test case similar to what you posted, 
but it didn't result in a crash. I'm going to mark this as resolved since you 
fixed it on your end, but if you can reduce it to a simple test case I could 
investigate further.

Original comment by AzuiSl...@gmail.com on 3 Feb 2012 at 12:16