Raised This Month: $51 Target: $400
 12% 

Commands Segfaulting at Cmd_ExecuteString()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
showdax
Senior Member
Join Date: Dec 2004
Old 12-15-2005 , 11:18   Commands Segfaulting at Cmd_ExecuteString()
Reply With Quote #1

Has anyone had this problem? Every once in a while executing one of my plugin's concommands causes this to happen:

Code:
pure virtual method called
terminate called without an active exception

Program received signal SIGABRT, Aborted.
[Switching to Thread -1218523008 (LWP 9561)]
0x005a1cef in raise () from /lib/tls/libc.so.6
(gdb) bt
#0  0x005a1cef in raise () from /lib/tls/libc.so.6
#1  0x005a34f5 in abort () from /lib/tls/libc.so.6
#2  0x0804b392 in __gnu_cxx::__verbose_terminate_handler ()
    at ../../.././libstdc++-v3/libsupc++/vterminate.cc:96
#3  0x00180a35 in __cxxabiv1::__terminate (
    handler=0x804b350 <__gnu_cxx::__verbose_terminate_handler()>)
    at ../../.././libstdc++-v3/libsupc++/eh_terminate.cc:43
#4  0x00180a72 in std::terminate ()
    at ../../.././libstdc++-v3/libsupc++/eh_terminate.cc:53
#5  0x001c39c6 in __cxa_pure_virtual ()
    at ../../.././libstdc++-v3/libsupc++/pure.cc:50
#6  0x0108aba7 in Cmd_ExecuteString ()
   from ./bin/engine_i686.so
#7  0x0108ae04 in Cbuf_Execute () from ./bin/engine_i686.so
#8  0x010c90de in _Host_RunFrame ()
   from ./bin/engine_i686.so
#9  0x010c983d in Host_RunFrame ()
   from ./bin/engine_i686.so
#10 0x010d1cfc in CHostState::State_Run ()
   from ./bin/engine_i686.so
#11 0x010d1f90 in CHostState::FrameUpdate ()
   from ./bin/engine_i686.so
#12 0x010d20d7 in HostState_Frame ()
---Type <return> to continue, or q <return> to quit---
   from ./bin/engine_i686.so
#13 0x01121bb8 in CEngine::Frame ()
   from ./bin/engine_i686.so
#14 0x0112120e in CDedicatedServerAPI::RunFrame ()
   from ./bin/engine_i686.so
#15 0x0013f692 in RunServer () from bin/dedicated_i686.so
#16 0x0013f915 in CDedicatedAppSystemGroup::Main () from bin/dedicated_i686.so
#17 0x0017c3a2 in CAppSystemGroup::Run () from bin/dedicated_i686.so
#18 0x0017c3a2 in CAppSystemGroup::Run () from bin/dedicated_i686.so
#19 0x0013fd0f in main () from bin/dedicated_i686.so
#20 0x0804903d in main ()
I can't really reproduce it all the time, and my commands work 99% of the time just fine. My plugin's a sourcemm plugin and it uses the CON_COMMAND_F() macro for declaring commands.

This is my cvars.h:
Code:
#ifndef _INCLUDE_CVARS_H
#define _INCLUDE_CVARS_H

#include <convar.h>

class AdminAccessor: public IConCommandBaseAccessor
{
public:
        virtual bool RegisterConCommandBase(ConCommandBase *pVar);
};

extern AdminAccessor g_Accessor;

#endif //_INCLUDE_CVARS_H
And here's snippets from cvars.cpp:
Code:
#include "CServerPluginAdmin.h"
#include "cvars.h"

AdminAccessor g_Accessor;

bool AdminAccessor::RegisterConCommandBase(ConCommandBase *pVar)
{
        return META_REGCVAR(pVar);
}

CON_COMMAND_F(admin_slay, "<name> - Slays specified player(s)", FCVAR_PLUGIN)
{
        int argc = g_Engine->Cmd_Argc();
        if (argc != 2)
        {
                META_CONPRINT("Usage: <name>\n");
                return;
        }

        CUtlVector<edict_t *> matches;
        g_AdminTools.findPlayers(&matches, g_Engine->Cmd_Argv(1), false);
        int length = matches.Count();
        if (length < 1)
        {
                META_CONPRINT("No matching players\n");
                return;
        }

        META_CONPRINT("Affected:\n");

        for (int i = 0; i < length; ++i)
        {
                edict_t *match = matches.Element(i);
                if (g_AdminTools.slay(match))
                        META_CONPRINTF("%s\n", g_Engine->GetClientConVarValue(g_Engine->IndexOfEdict(match), "name"));
                else
                        META_CONPRINTF("%s (failed)\n", g_Engine->GetClientConVarValue(g_Engine->IndexOfEdict(match), "name"));
        }
}
And in CServerPluginAdmin.cpp:
Code:
bool CServerPluginAdmin::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
{
        PLUGIN_SAVEVARS();

[IVEngineServer finding code]

ConCommandBaseMgr::OneTimeInit(&g_Accessor);

[other interfaces]

        return true;
}
What am I doing wrong?
showdax is offline
Send a message via MSN to showdax
BAILOPAN
Join Date: Jan 2004
Old 12-15-2005 , 15:01  
Reply With Quote #2

What's the difference between CON_COMMAND and CON_COMMAND_F (sorry don't have SDK on me)?
__________________
egg
BAILOPAN is offline
showdax
Senior Member
Join Date: Dec 2004
Old 12-15-2005 , 15:12  
Reply With Quote #3

CON_COMMAND_F allows you to specify flags:
Code:
#define CON_COMMAND( name, description ) \
   static void name(); \
   static ConCommand name##_command( #name, name, description ); \
   static void name()

#define CON_COMMAND_F( name, description, flags ) \
   static void name(); \
   static ConCommand name##_command( #name, name, description, flags); \
   static void name()
The crash occurs regardless of what macro I use.
showdax is offline
Send a message via MSN to showdax
showdax
Senior Member
Join Date: Dec 2004
Old 12-15-2005 , 16:15  
Reply With Quote #4

Okay, well now I'm not so sure it's my plugin's fault. I just had a similar crash, but I wasn't at the server or running any commands:
Code:
pure virtual method called
terminate called without an active exception

Program received signal SIGABRT, Aborted.
[Switching to Thread -1218523008 (LWP 4069)]
0x0027fcef in raise () from /lib/tls/libc.so.6
(gdb) bt
#0  0x0027fcef in raise () from /lib/tls/libc.so.6
#1  0x002814f5 in abort () from /lib/tls/libc.so.6
#2  0x0804b392 in __gnu_cxx::__verbose_terminate_handler ()
    at ../../.././libstdc++-v3/libsupc++/vterminate.cc:96
#3  0x00eb7a35 in __cxxabiv1::__terminate (
    handler=0x804b350 <__gnu_cxx::__verbose_terminate_handler()>)
    at ../../.././libstdc++-v3/libsupc++/eh_terminate.cc:43
#4  0x00eb7a72 in std::terminate ()
    at ../../.././libstdc++-v3/libsupc++/eh_terminate.cc:53
#5  0x007329c6 in __cxa_pure_virtual ()
    at ../../.././libstdc++-v3/libsupc++/pure.cc:50
#6  0x011ec475 in CGameClient::ExecuteStringCommand ()
   from ./bin/engine_i686.so
#7  0x011ffaba in CBaseClient::ProcessStringCmd ()
   from ./bin/engine_i686.so
#8  0x01133709 in NET_StringCmd::Process ()
   from ./bin/engine_i686.so
#9  0x0119ae3e in CNetChan::ProcessMessages ()
   from ./bin/engine_i686.so
#10 0x0119af97 in CNetChan::CheckReceivingList ()
   from ./bin/engine_i686.so
#11 0x0119c40b in CNetChan::ProcessPacket ()
   from ./bin/engine_i686.so
---Type <return> to continue, or q <return> to quit---
#12 0x011a4c28 in NET_ProcessSocket ()
   from ./bin/engine_i686.so
#13 0x011f255a in CBaseServer::RunFrame ()
   from ./bin/engine_i686.so
#14 0x011c3d4c in SV_Frame () from ./bin/engine_i686.so
#15 0x01178db4 in _Host_RunFrame_Server ()
   from ./bin/engine_i686.so
#16 0x011794cc in _Host_RunFrame ()
   from ./bin/engine_i686.so
#17 0x0117983d in Host_RunFrame ()
   from ./bin/engine_i686.so
#18 0x01181cfc in CHostState::State_Run ()
   from ./bin/engine_i686.so
#19 0x01181f90 in CHostState::FrameUpdate ()
   from ./bin/engine_i686.so
#20 0x011820d7 in HostState_Frame ()
   from ./bin/engine_i686.so
#21 0x011d1bb8 in CEngine::Frame ()
   from ./bin/engine_i686.so
#22 0x011d120e in CDedicatedServerAPI::RunFrame ()
   from ./bin/engine_i686.so
#23 0x00e76692 in RunServer () from bin/dedicated_i686.so
#24 0x00e76915 in CDedicatedAppSystemGroup::Main () from bin/dedicated_i686.so
---Type <return> to continue, or q <return> to quit---
#25 0x00eb33a2 in CAppSystemGroup::Run () from bin/dedicated_i686.so
#26 0x00eb33a2 in CAppSystemGroup::Run () from bin/dedicated_i686.so
#27 0x00e76d0f in main () from bin/dedicated_i686.so
#28 0x0804903d in main ()
The plugin wasn't even loaded at the time either!
showdax is offline
Send a message via MSN to showdax
BAILOPAN
Join Date: Jan 2004
Old 12-16-2005 , 14:21  
Reply With Quote #5

That's... uh... concerning sounds like a bad cvar is registered or something.
__________________
egg
BAILOPAN is offline
showdax
Senior Member
Join Date: Dec 2004
Old 12-16-2005 , 16:46  
Reply With Quote #6

Well alfred said it might be related to the ABI version, so I tried -fabi-version=1 and it still crashes like that, though setting that was probably not a good idea.

I'm out of ideas though. If anyone wants see if there's anything wrong, I can post the source to the plugin at some point. If I can just get this fixed it would be pretty much ready to be released.
showdax is offline
Send a message via MSN to showdax
showdax
Senior Member
Join Date: Dec 2004
Old 12-28-2005 , 23:56  
Reply With Quote #7

Well, this same crash happened again and my plugin hadn't been loaded at all since the server started. I'm thinking it's either an EventScripts problem, SourceMM problem, or Stripper problem. If not, it could just be Valve's fault, but I guess I'll start eliminating each variable until it no longer occurs.
showdax is offline
Send a message via MSN to showdax
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 12-29-2005 , 11:35  
Reply With Quote #8

I dont think its srcds on its own anyway.
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
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 03:46.


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