alliedmodders / metamod-source

Metamod:Source - C++ Plugin Environment and Detour Library for the Source Engine
http://www.metamodsource.net/
Other
374 stars 83 forks source link

"srcds_linux" received signal SIGSEGV, Segmentation fault. #107

Closed petejefferson closed 1 year ago

petejefferson commented 1 year ago

Platform: Ubuntu 22.04

Mod: Day of Defeat: Source.

Metamod:Source Version Information Metamod:Source version 1.11.0-dev+1145 Plugin interface version: 16:14 SourceHook version: 5:5 Loaded As: Valve Server Plugin Compiled on: Jul 11 2021 22:33:04 Built from: https://github.com/alliedmodders/metamod-source/commit/0bb53f2 Build ID: 1145:0bb53f2 http://www.metamodsource.net/

SourceMod Version Information: SourceMod Version: 1.11.0.6926 SourcePawn Engine: 1.11.0.6926, jit-x86 (build 1.11.0.6926) SourcePawn API: v1 = 5, v2 = 16 Compiled on: Dec 20 2022 14:00:51 Built from: https://github.com/alliedmodders/sourcemod/commit/fd63fff8 Build ID: 6926:fd63fff8 http://www.sourcemod.net/

I'm also running RCBot2: meta list Listing 3 plugins: [01] RCBot2 (1.4 (apg-nosoop-caxanga334)-2cb61a96) by Cheeseh, RoboCop, nosoop, caxanga334 [02] SourceMod (1.11.0.6926) by AlliedModders LLC [03] SDK Tools (1.11.0.6926) by AlliedModders LLC

The server is running 18 bots (no humans) and crashes at random times.

Output from gdb: Thread 1 "srcds_linux" received signal SIGSEGV, Segmentation fault. 0xf2905149 in CPhysicsProp::CreateVPhysics() () from /home/dodsserver/serverfiles/dod/bin/server_srv.so (gdb) where

0 0xf2905149 in CPhysicsProp::CreateVPhysics() () from /home/dodsserver/serverfiles/dod/bin/server_srv.so

1 0xf290a24c in CPhysicsProp::Spawn() () from /home/dodsserver/serverfiles/dod/bin/server_srv.so

2 0xf29189a4 in CPhysicsPropMultiplayer::Spawn() () from /home/dodsserver/serverfiles/dod/bin/server_srv.so

3 0xf299d507 in DispatchSpawn(CBaseEntity*) () from /home/dodsserver/serverfiles/dod/bin/server_srv.so

4 0xf288430d in SpawnAllEntities(int, HierarchicalSpawn_t*, bool) () from /home/dodsserver/serverfiles/dod/bin/server_srv.so

5 0xf2885326 in MapEntity_ParseAllEntities(char const, IMapEntityFilter, bool) () from /home/dodsserver/serverfiles/dod/bin/server_srv.so

6 0xf285ccdf in CServerGameDLL::LevelInit(char const, char const, char const, char const, bool, bool) ()

from /home/dodsserver/serverfiles/dod/bin/server_srv.so

7 0xee9a00c8 in __SourceHook_MFHCls_SGD_LevelInit::Func(char const, char const, char const, char const, bool, bool) ()

from /home/dodsserver/serverfiles/dod/addons/metamod/bin/metamod.2.dods.so

8 0xeb98073f in SourceModBase::LevelInit(char const, char const, char const, char const, bool, bool) ()

from /home/dodsserver/serverfiles/dod/addons/sourcemod/bin/sourcemod.2.dods.so

9 0xeb9824a1 in __SourceHook_FHCls_IServerGameDLLLevelInitfalse::CMyDelegateImpl::Call(char const, char const, char const, char const, bool, bool) ()

from /home/dodsserver/serverfiles/dod/addons/sourcemod/bin/sourcemod.2.dods.so

10 0xee9a0046 in __SourceHook_MFHCls_SGD_LevelInit::Func(char const, char const, char const, char const, bool, bool) ()

from /home/dodsserver/serverfiles/dod/addons/metamod/bin/metamod.2.dods.so

11 0xf67b5330 in CServerPlugin::LevelInit(char const, char const, char const, char const, bool, bool) () from /home/dodsserver/serverfiles/bin/engine_srv.so

12 0xf6728d03 in Host_Changelevel(bool, char const, char const) () from /home/dodsserver/serverfiles/bin/engine_srv.so

13 0xf67347d5 in CHostState::State_ChangeLevelMP() () from /home/dodsserver/serverfiles/bin/engine_srv.so

14 0xf6734c41 in CHostState::FrameUpdate(float) () from /home/dodsserver/serverfiles/bin/engine_srv.so

15 0xf6734d19 in HostState_Frame(float) () from /home/dodsserver/serverfiles/bin/engine_srv.so

16 0xf67c64ee in CEngine::Frame() () from /home/dodsserver/serverfiles/bin/engine_srv.so

17 0xf67c37b6 in CDedicatedServerAPI::RunFrame() () from /home/dodsserver/serverfiles/bin/engine_srv.so

18 0xf737b432 in ?? ()

19 0xf67c38ad in CModAppSystemGroup::Main() () from /home/dodsserver/serverfiles/bin/engine_srv.so

20 0xf6804820 in CAppSystemGroup::Run() () from /home/dodsserver/serverfiles/bin/engine_srv.so

21 0xf67c459f in CDedicatedServerAPI::ModInit(ModInfo_t&) () from /home/dodsserver/serverfiles/bin/engine_srv.so

22 0xf737b1b3 in ?? ()

23 0xf739cb10 in ?? ()

24 0xf739cb10 in ?? ()

25 0xf73453f6 in ?? ()

26 0x080489b9 in main ()

psychonic commented 1 year ago

What is leading you to believe that Metamod:Source is the cause of the crash?

petejefferson commented 1 year ago

It's entirely possible that another plugin could be the cause of the crash, namely RCBot2. Following the call stack I see that __SourceHook_MFHCls_SGD_LevelInit (frame #10) is the first point of entry in to Metamod which leads up to the crash.

Perhaps one of the parameters being passed in is being trashed. I can add in parameter validation checking to see if I can discover anything further,

psychonic commented 1 year ago

SourceHook will be in the stack for any call to LevelInit because MM:S has a hook on it. However, it does not perform much logic in that hook, but rather it's solely for calling a notification function for letting MM:S plugins know that the level has started.

In #6, you can see that control has been handled back off to the original, hooked function, and everything called after that in the stack is also game functions from server_srv.so rather than a plugin. MapEntity_ParseAllEntities is also in the stack, higher than that, which implies that either an entity in the map has bad physics, or that a plugin (similar to Stripper:Source or a SourceMod plugin using the new-ish level entities modification support) is altering the map entity list to cause that. RCBot2 could also have a hook on LevelInit that does similar. I'm not familiar with its code offhand. Another possibility is that it is being caused by a plugin that alters entities upon creation, before they are spawned. That wouldn't show in this stack trace due to the disjointed nature of entity creation and spawning.

petejefferson commented 1 year ago

Cool. Thank you. I'll take a look at RCBot2.

petejefferson commented 1 year ago

Just to completely close this off, this issue was caused by a corrupt installation of DoD:s server. Re-installing fixed the problem.

The error only occurred whilst switching to dod_avalanche, Unfortunately I don't have the complete error message from the log but it pointed to a problem with reading the physics file associated with a ladder.