Raised This Month: $32 Target: $400
 8% 

Server Crashing [Sourcehook RecallGetIFace]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 03-31-2009 , 08:08   Server Crashing [Sourcehook RecallGetIFace]
Reply With Quote #1

So this just started happening tonight and im not sure why as I havent really changed anything at all. The few additions I did make were totally unrelated, didnt use Sourcehook at all, and I removed them and its still occuring.

The problem seems to be with my prehook on LevelInit() however its been there for months and hasnt caused any problems. The exact line I dont think it likes is...

SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, 0, bool, char const *, char const *, char const *, char const *, bool, bool);

but as I said before, until now its worked perfectly. Nothing massive has changed in the least so this is extremely odd. Heres a picture of the callstack trace, and so on.

http://imagenouch.com/images/2009/Mar/11238501157.PNG
__________________
CrimsonGT is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 03-31-2009 , 08:59   Re: Server Crashing [Sourcehook RecallGetIFace]
Reply With Quote #2

Looks like ( and I'm no real expert here ) that your sourcehook pointer isn't set.

Looks like the error comes from the shptr->GetIfacePtr()
Keeper is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 03-31-2009 , 09:17   Re: Server Crashing [Sourcehook RecallGetIFace]
Reply With Quote #3

I dunno, still not sure how that could have happened as everything has been working fine. Not to mention it adds various hooks prior to that one.
__________________
CrimsonGT is offline
BAILOPAN
Join Date: Jan 2004
Old 03-31-2009 , 11:56   Re: Server Crashing [Sourcehook RecallGetIFace]
Reply With Quote #4

Yeah, the SMSDK sets the shptr pointer for you. Though just to be sure you can always inspect it with the debugger.
__________________
egg
BAILOPAN is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 03-31-2009 , 12:23   Re: Server Crashing [Sourcehook RecallGetIFace]
Reply With Quote #5

Yeah it seems to be fine, so I am still clueless. Ive been tinkering for hours and cannot figure out what the problem is.
__________________
CrimsonGT is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 03-31-2009 , 13:38   Re: Server Crashing [Sourcehook RecallGetIFace]
Reply With Quote #6

Seems something there is null. Maybe the definition of your IServerGameDLL variable??? Be my next guess.
Keeper is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-31-2009 , 16:57   Re: Server Crashing [Sourcehook RecallGetIFace]
Reply With Quote #7

Mhhh, that call stack looks weird.
At the bottom engine.dll calls LevelInit
Then the hookfunc in metamod.2.ep2.dll gets called (because the metamod core is the first thing that registered a hook on LevelInit)
It first calls your PreHook handler over CMyDelegateImpl and FastDelegate.
Why does it jump back into metamod...dll ? Your handler function should be there instead.
Then some bogus address and then RecallGetIface. RecallGetIface will probably be correct if you're doing RETURN_META_(..)NEWPARAMS but the jump from FastDelegate into metamod.dll and then into an address which seems to be on the heap looks like the stack might have been corrupted.

Or I'm wrong, I'm tired, I'll take another look tomorrow.
Would you mind sharing some code? Your LevelInit handler might help a bit.
__________________
hello, i am pm
PM is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 03-31-2009 , 17:02   Re: Server Crashing [Sourcehook RecallGetIFace]
Reply With Quote #8

Certainly, I appreciate the help.

Code:
char *g_MapEntLists; //Stores list of all Map Entities on LevelInit()

//-----------------------------------------------------------------------------
// Purpose: Get the list of Map Entities before they are all created in the
// server and insert our own entities into the map we need.
//-----------------------------------------------------------------------------
bool TF2RocketArena::Hook_LevelInit(const char *pMapName,
                                char const *pMapEntities,
                                char const *pOldLevel,
                                char const *pLandmarkName,
                                bool loadGame,
                                bool background)
{
    //If the Server is running clan arena mode
    if(g_ClanArenaMode.GetInt() == 1)
    {
        char strArenaLogic[255] = "{ \"CapEnableDelay\" \"600\" \"classname\" \"tf_logic_arena\" }";

        size_t StrEntLen = strlen(pMapEntities) + strlen(strArenaLogic) + 64;
        g_MapEntLists = new char [StrEntLen];

        strcpy(g_MapEntLists, pMapEntities);
        strcat(g_MapEntLists, strArenaLogic);

        RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, true, &IServerGameDLL::LevelInit, (pMapName, g_MapEntLists, pOldLevel, pLandmarkName, loadGame, background));
    }

    RETURN_META_VALUE(MRES_IGNORED, NULL);
}
__________________
CrimsonGT is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 04-01-2009 , 11:22   Re: Server Crashing [Sourcehook RecallGetIFace]
Reply With Quote #9

Mmm, I don't see anything wrong. Have you tried to put that hook alone in a separate test plugin?


Another problem with that callstack is:
RETURN_META_VALUE_NEWPARAMS calls:

SH_GLOB_SHPTR->SetRes
SH_GLOB_SHPTR->DoRecall
SH_GLOB_SHPTR->GetIface
in that order.

So if shptr was null it should crash on the first one.
__________________
hello, i am pm
PM is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 04-01-2009 , 12:26   Re: Server Crashing [Sourcehook RecallGetIFace]
Reply With Quote #10

In his .png tho, the shptr is null in the call stack. That just doesn't make sense on why it would be that way.
Keeper is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode