alliedmodders / metamod-source

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

Crash on server shutdown #86

Closed accelerator74 closed 3 years ago

accelerator74 commented 3 years ago

Sometimes when the server shutdown, I get a crash. The server is restarted with the _restart command. MetaMod 1.11.1144

Backtrace:

#0  0xf00df78b in SourceHook::CPageAlloc::Free(void*) () from /home/user/l4d2_coop/left4dead2/addons/metamod/bin/metamod.2.l4d2.so
#1  0xf00e0560 in SourceHook::Impl::GenContext::~GenContext() () from /home/user/l4d2_coop/left4dead2/addons/metamod/bin/metamod.2.l4d2.so
#2  0xf00e635f in SourceHook::Impl::CHookManagerAutoGen::~CHookManagerAutoGen() () from /home/user/l4d2_coop/left4dead2/addons/metamod/bin/metamod.2.l4d2.so
#3  0xf7cfbdf5 in __cxa_finalize () from /lib32/libc.so.6
#4  0xf00d1b03 in __do_global_dtors_aux () from /home/user/l4d2_coop/left4dead2/addons/metamod/bin/metamod.2.l4d2.so
#5  0xf7ef0c3c in ?? () from /lib/ld-linux.so.2
#6  0xf7ef1643 in ?? () from /lib/ld-linux.so.2
#7  0xf7dff45c in _dl_catch_exception () from /lib32/libc.so.6
#8  0xf7dff500 in _dl_catch_error () from /lib32/libc.so.6
#9  0xf7ecaa71 in ?? () from /lib32/libdl.so.2
#10 0xf7eca411 in dlclose () from /lib32/libdl.so.2
#11 0xf6b1a4ac in mm_UnloadLibrary(void*) () from /home/user/l4d2_coop/left4dead2/addons/metamod/bin/server.so
#12 0xf6b1851f in mm_UnloadMetamodLibrary() () from /home/user/l4d2_coop/left4dead2/addons/metamod/bin/server.so
#13 0xf6b19de9 in ServerPlugin::Unload() () from /home/user/l4d2_coop/left4dead2/addons/metamod/bin/server.so
#14 0xf720811c in CPlugin::Unload() () from /home/user/l4d2_coop/bin/engine_srv.so
#15 0xf72088b9 in CServerPlugin::UnloadPlugins() () from /home/user/l4d2_coop/bin/engine_srv.so
#16 0xf71fb6d5 in SV_ShutdownGameDLL() () from /home/user/l4d2_coop/bin/engine_srv.so
#17 0xf7215142 in CModAppSystemGroup::Main() () from /home/user/l4d2_coop/bin/engine_srv.so
#18 0xf726a028 in CAppSystemGroup::Run() () from /home/user/l4d2_coop/bin/engine_srv.so
#19 0xf7215faf in CDedicatedServerAPI::ModInit(ModInfo_t&) () from /home/user/l4d2_coop/bin/engine_srv.so
#20 0xf74ba845 in CDedicatedAppSystemGroup::Main() () from bin/dedicated_srv.so
#21 0xf74db498 in CAppSystemGroup::Run() () from bin/dedicated_srv.so
#22 0xf74db498 in CAppSystemGroup::Run() () from bin/dedicated_srv.so
#23 0xf7485197 in main () from bin/dedicated_srv.so
#24 0x08048722 in main ()
asherkin commented 3 years ago

What is the crash reason? Do you have a coredump you can share?

I don't think that stack trace indicates an issue in MM:S, it's possibly just the memory allocator detecting heap corruption.

accelerator74 commented 3 years ago

Unfortunately there is no access to the dump itself. There is only a stacktrace.

The cause of the crash is not clear. It's just that sometimes the server crashes on restart. Here is the log from the console

[...]
Dropped Moonlight Blitz from server (Server shutting down)
Dropped NAPSAKKİ YA AMANNNN SENDE CANI from server (Server shutting down)
ChargerCollision patch restored 'CCharge::HandleCustomCollision'
ChargerCollision restored 'z_charge_max_force/z_charge_min_force' convars'
WitchPatch restored 'WitchAttack::OnMoveToFailure_1'
WitchPatch restored 'WitchAttack::OnMoveToFailure_2'
WitchPatch restored 'WitchAttack::GetVictim'
Segmentation fault (core dumped)
Add "-debug" to the ./srcds_run command line to generate a debug.log to help with solving this problem
accelerator74 commented 3 years ago

Some people argue that this is a problem with Dhooks. When there are some active hooks through dhooks, and try to shut down the server, it will crash.

Well it looks like this is not a metamod problem.

peace-maker commented 3 years ago

This might already be fixed by https://github.com/peace-maker/DHooks2/commit/314f9264e88937145a84001d9877015bd113278c which didn't make its way into a release yet. Can't tell from the stacktrace only.

Electr0 commented 1 year ago

this crash was return, i see it on

SourceMod Version: 1.11.0.6936 Metamod:Source version 1.11.0-dev+1148

if any plugins have dhooks hooks active and i am send quit cmd, server crash.

----------------------------------------------
CRASH: Wed Aug  9 18:24:55 MSK 2023
Start Line: ./srcds_linux -game left4dead2 -strictportbind -ip x.x.x.x -port x +clientport 27005 +map c2m1_highway +mp_gamemode versus +exec server.cfg -tickrate 100 -nowatchdog -debug
[New LWP 386447]
[New LWP 386469]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./srcds_linux -game left4dead2 -strictportbind -ip x.x.x.x -port x +c'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xf01d9d60 in SourceHook::CPageAlloc::Free(void*) () from /home/example/serverfiles/left4dead2/addons/metamod/bin/metamod.2.l4d2.so
[Current thread is 1 (Thread 0xf7f70ac0 (LWP 386447))]
#0  0xf01d9d60 in SourceHook::CPageAlloc::Free(void*) () from /home/example/serverfiles/left4dead2/addons/metamod/bin/metamod.2.l4d2.so
#1  0xf01dac90 in SourceHook::Impl::GenContext::~GenContext() () from /home/example/serverfiles/left4dead2/addons/metamod/bin/metamod.2.l4d2.so
#2  0xf01e1d2f in SourceHook::Impl::CHookManagerAutoGen::~CHookManagerAutoGen() () from /home/example/serverfiles/left4dead2/addons/metamod/bin/metamod.2.l4d2.so
#3  0xf7d84551 in __cxa_finalize () from /lib/i386-linux-gnu/libc.so.6
#4  0xf01cb723 in __do_global_dtors_aux () from /home/example/serverfiles/left4dead2/addons/metamod/bin/metamod.2.l4d2.so
#5  0xf7f8b842 in ?? () from /lib/ld-linux.so.2
#6  0xf7e91324 in _dl_catch_exception () from /lib/i386-linux-gnu/libc.so.6
#7  0xf7f8be15 in ?? () from /lib/ld-linux.so.2
#8  0xf7f8ca97 in ?? () from /lib/ld-linux.so.2
#9  0xf7e912bb in _dl_catch_exception () from /lib/i386-linux-gnu/libc.so.6
#10 0xf7e91394 in _dl_catch_error () from /lib/i386-linux-gnu/libc.so.6
#11 0xf7f63bf5 in ?? () from /lib/i386-linux-gnu/libdl.so.2
#12 0xf7f63525 in dlclose () from /lib/i386-linux-gnu/libdl.so.2
#13 0xf6c191cc in mm_UnloadLibrary(void*) () from /home/example/serverfiles/left4dead2/addons/metamod/bin/server.so
#14 0xf6c1700f in mm_UnloadMetamodLibrary() () from /home/example/serverfiles/left4dead2/addons/metamod/bin/server.so
#15 0xf6c18ac3 in ServerPlugin::Unload() () from /home/example/serverfiles/left4dead2/addons/metamod/bin/server.so
#16 0xf72ff22c in CPlugin::Unload() () from /home/example/serverfiles/bin/engine_srv.so
#17 0xf72ff9c9 in CServerPlugin::UnloadPlugins() () from /home/example/serverfiles/bin/engine_srv.so
#18 0xf72f27e5 in SV_ShutdownGameDLL() () from /home/example/serverfiles/bin/engine_srv.so
#19 0xf730c512 in CModAppSystemGroup::Main() () from /home/example/serverfiles/bin/engine_srv.so
#20 0xf7361968 in CAppSystemGroup::Run() () from /home/example/serverfiles/bin/engine_srv.so
#21 0xf730d37f in CDedicatedServerAPI::ModInit(ModInfo_t&) () from /home/example/serverfiles/bin/engine_srv.so
#22 0xf75b29c5 in CDedicatedAppSystemGroup::Main() () from bin/dedicated_srv.so
#23 0xf75d3a58 in CAppSystemGroup::Run() () from bin/dedicated_srv.so
#24 0xf75d3a58 in CAppSystemGroup::Run() () from bin/dedicated_srv.so
#25 0xf757dff7 in main () from bin/dedicated_srv.so
#26 0x08048722 in main ()
No symbol table info available.
eax            0xf0201274          -266333580
ecx            0xf7f3b000          -135024640
edx            0x37d8              14296
ebx            0xf0200438          -266337224
esp            0xff9dcc80          0xff9dcc80
ebp            0xff9dcc98          0xff9dcc98
esi            0xf7f681c0          -134839872
edi            0x0                 0
eip            0xf01d9d60          0xf01d9d60 <SourceHook::CPageAlloc::Free(void*)+32>
eflags         0x210292            [ AF SF IF RF ID ]
cs             0x23                35
ss             0x2b                43
ds             0x2b                43
es             0x2b                43
fs             0x0                 0
gs             0x63                99
From        To          Syms Read   Shared Object Library
0xf7f63230  0xf7f64368  Yes (*)     /lib/i386-linux-gnu/libdl.so.2
0xf7f44b20  0xf7f55568  Yes (*)     /lib/i386-linux-gnu/libpthread.so.0
0xf7d691d0  0xf7ec274a  Yes (*)     /lib/i386-linux-gnu/libc.so.6
0xf7f77100  0xf7f94893  Yes (*)     /lib/ld-linux.so.2
0xf7d222d0  0xf7d38768  Yes (*)     bin/libtier0_srv.so
0xf7d0e770  0xf7d12838  Yes (*)     /lib/i386-linux-gnu/librt.so.1
0xf7c7f914  0xf7cc5c78  Yes         bin/libstdc++.so.6
0xf7b3e2b0  0xf7bff704  Yes (*)     /lib/i386-linux-gnu/libm.so.6
0xf7b1fe00  0xf7b2f0fc  Yes         bin/libgcc_s.so.1
0xf7a36d00  0xf7a5ad14  Yes (*)     bin/libvstdlib_srv.so
0xf757d1f0  0xf75ef568  Yes (*)     bin/dedicated_srv.so
0xf7515c60  0xf7543364  Yes (*)     bin/libsteam_api.so
0xf7188630  0xf7395ba8  Yes (*)     /home/example/serverfiles/bin/engine_srv.so
0xf6c32e40  0xf6c5eec4  Yes (*)     /home/example/serverfiles/bin/soundemittersystem_srv.so
0xf6abfde0  0xf6b83184  Yes (*)     /home/example/serverfiles/bin/materialsystem_srv.so
0xf557faa0  0xf5625044  Yes (*)     /home/example/serverfiles/bin/studiorender_srv.so
0xf5322d10  0xf54cd188  Yes (*)     /home/example/serverfiles/bin/vphysics_srv.so
0xf525c260  0xf52b0924  Yes (*)     /home/example/serverfiles/bin/datacache_srv.so
0xf51a3260  0xf520c054  Yes (*)     /home/example/serverfiles/bin/vscript_srv.so
0xf5171510  0xf5183104  Yes (*)     /home/example/serverfiles/bin/shaderapiempty_srv.so
0xed950e50  0xed9ce584  Yes (*)     /home/example/serverfiles/left4dead2/bin/matchmaking_ds_srv.so
0xecc493f0  0xed4cbdf4  Yes (*)     /home/example/serverfiles/left4dead2/bin/server_srv.so
0xec8c8dd0  0xec8d9db4  Yes (*)     /home/example/serverfiles/bin/scenefilecache_srv.so
0xf6c16ca0  0xf6c19384  Yes (*)     /home/example/serverfiles/left4dead2/addons/metamod/bin/server.so
0xf01cb000  0xf01f92b2  Yes (*)     /home/example/serverfiles/left4dead2/addons/metamod/bin/metamod.2.l4d2.so
0xe64f9000  0xe7d5afe4  Yes (*)     /home/example/.steam/sdk32/steamclient.so
0xefd903b0  0xefe879c4  Yes (*)     /home/example/serverfiles/left4dead2/addons/sourcemod/bin/sourcemod.2.l4d2.so
0xdb5d85d0  0xdb5df178  Yes (*)     /lib/i386-linux-gnu/libnss_files.so.2
0xdb22a350  0xdb22d2f8  Yes (*)     /lib/i386-linux-gnu/libnss_dns.so.2
0xda516730  0xda5227e8  Yes (*)     /lib/i386-linux-gnu/libresolv.so.2
(*): Shared library is missing debugging information.
Dump of assembler code for function _ZN10SourceHook10CPageAlloc4FreeEPv:
   0xf01d9d40 <+0>: push   %ebp
   0xf01d9d41 <+1>: mov    %esp,%ebp
   0xf01d9d43 <+3>: push   %ebx
   0xf01d9d44 <+4>: push   %edi
   0xf01d9d45 <+5>: push   %esi
   0xf01d9d46 <+6>: sub    $0xc,%esp
   0xf01d9d49 <+9>: call   0xf01d9d4e <_ZN10SourceHook10CPageAlloc4FreeEPv+14>
   0xf01d9d4e <+14>:    pop    %ebx
   0xf01d9d4f <+15>:    add    $0x266ea,%ebx
   0xf01d9d55 <+21>:    mov    0xc(%ebp),%esi
   0xf01d9d58 <+24>:    mov    0x8(%ebp),%eax
   0xf01d9d5b <+27>:    mov    0x8(%eax),%edi
   0xf01d9d5e <+30>:    xchg   %ax,%ax
=> 0xf01d9d60 <+32>:    mov    0x1c(%edi),%edi
   0xf01d9d63 <+35>:    test   %edi,%edi
   0xf01d9d65 <+37>:    je     0xf01d9d90 <_ZN10SourceHook10CPageAlloc4FreeEPv+80>
   0xf01d9d67 <+39>:    mov    0x8(%ebp),%eax
   0xf01d9d6a <+42>:    cmp    0x8(%eax),%edi
   0xf01d9d6d <+45>:    je     0xf01d9e40 <_ZN10SourceHook10CPageAlloc4FreeEPv+256>
   0xf01d9d73 <+51>:    mov    %esi,0x4(%esp)
   0xf01d9d77 <+55>:    mov    %edi,(%esp)
   0xf01d9d7a <+58>:    call   0xf01d9e50 <_ZN10SourceHook10CPageAlloc15AllocatedRegion7TryFreeEPv>
   0xf01d9d7f <+63>:    test   %al,%al
   0xf01d9d81 <+65>:    je     0xf01d9d60 <_ZN10SourceHook10CPageAlloc4FreeEPv+32>
   0xf01d9d83 <+67>:    mov    %edi,%eax
   0xf01d9d85 <+69>:    jmp    0xf01d9dae <_ZN10SourceHook10CPageAlloc4FreeEPv+110>
   0xf01d9d87 <+71>:    nopw   0x0(%eax,%eax,1)
   0xf01d9d90 <+80>:    mov    0x8(%ebp),%eax
   0xf01d9d93 <+83>:    cmp    0x8(%eax),%edi
   0xf01d9d96 <+86>:    je     0xf01d9e40 <_ZN10SourceHook10CPageAlloc4FreeEPv+256>
   0xf01d9d9c <+92>:    mov    %esi,0x4(%esp)
   0xf01d9da0 <+96>:    mov    %edi,(%esp)
   0xf01d9da3 <+99>:    call   0xf01d9e50 <_ZN10SourceHook10CPageAlloc15AllocatedRegion7TryFreeEPv>
   0xf01d9da8 <+104>:   test   %al,%al
   0xf01d9daa <+106>:   je     0xf01d9d90 <_ZN10SourceHook10CPageAlloc4FreeEPv+80>
   0xf01d9dac <+108>:   xor    %eax,%eax
   0xf01d9dae <+110>:   cmpl   $0x0,0x14(%edi)
   0xf01d9db2 <+114>:   jne    0xf01d9e40 <_ZN10SourceHook10CPageAlloc4FreeEPv+256>
   0xf01d9db8 <+120>:   mov    %eax,-0x10(%ebp)
   0xf01d9dbb <+123>:   mov    (%edi),%eax
   0xf01d9dbd <+125>:   mov    0x4(%edi),%ecx
   0xf01d9dc0 <+128>:   mov    %ecx,0x4(%esp)
   0xf01d9dc4 <+132>:   mov    %eax,(%esp)
   0xf01d9dc7 <+135>:   call   0xf01caf10 <munmap@plt>
   0xf01d9dcc <+140>:   mov    0x1c(%edi),%eax
   0xf01d9dcf <+143>:   mov    0x20(%edi),%ecx
   0xf01d9dd2 <+146>:   mov    %eax,0x1c(%ecx)
   0xf01d9dd5 <+149>:   mov    0x1c(%edi),%eax
   0xf01d9dd8 <+152>:   mov    0x20(%edi),%ecx
   0xf01d9ddb <+155>:   mov    %ecx,0x20(%eax)
   0xf01d9dde <+158>:   mov    0x10(%edi),%ecx
   0xf01d9de1 <+161>:   mov    0x8(%ecx),%eax
   0xf01d9de4 <+164>:   mov    %ecx,0x8(%ecx)
   0xf01d9de7 <+167>:   mov    0x10(%edi),%ecx
   0xf01d9dea <+170>:   mov    %ecx,0xc(%ecx)
   0xf01d9ded <+173>:   mov    0x10(%edi),%ecx
   0xf01d9df0 <+176>:   cmp    %ecx,%eax
   0xf01d9df2 <+178>:   je     0xf01d9e1a <_ZN10SourceHook10CPageAlloc4FreeEPv+218>
   0xf01d9df4 <+180>:   data16 data16 nopw %cs:0x0(%eax,%eax,1)
   0xf01d9e00 <+192>:   mov    0x8(%eax),%esi
   0xf01d9e03 <+195>:   test   %eax,%eax
   0xf01d9e05 <+197>:   je     0xf01d9e12 <_ZN10SourceHook10CPageAlloc4FreeEPv+210>
   0xf01d9e07 <+199>:   mov    %eax,(%esp)
   0xf01d9e0a <+202>:   call   0xf01cac40 <_ZdlPv@plt>
   0xf01d9e0f <+207>:   mov    0x10(%edi),%ecx
   0xf01d9e12 <+210>:   cmp    %ecx,%esi
   0xf01d9e14 <+212>:   mov    %esi,%eax
   0xf01d9e16 <+214>:   jne    0xf01d9e00 <_ZN10SourceHook10CPageAlloc4FreeEPv+192>
   0xf01d9e18 <+216>:   jmp    0xf01d9e1c <_ZN10SourceHook10CPageAlloc4FreeEPv+220>
   0xf01d9e1a <+218>:   mov    %eax,%esi
   0xf01d9e1c <+220>:   movl   $0x0,0x14(%edi)
   0xf01d9e23 <+227>:   test   %esi,%esi
   0xf01d9e25 <+229>:   je     0xf01d9e2f <_ZN10SourceHook10CPageAlloc4FreeEPv+239>
   0xf01d9e27 <+231>:   mov    %esi,(%esp)
   0xf01d9e2a <+234>:   call   0xf01cac90 <free@plt>
   0xf01d9e2f <+239>:   mov    -0x10(%ebp),%eax
   0xf01d9e32 <+242>:   mov    %eax,(%esp)
   0xf01d9e35 <+245>:   call   0xf01cac40 <_ZdlPv@plt>
   0xf01d9e3a <+250>:   mov    0x8(%ebp),%eax
   0xf01d9e3d <+253>:   decl   0xc(%eax)
   0xf01d9e40 <+256>:   add    $0xc,%esp
   0xf01d9e43 <+259>:   pop    %esi
   0xf01d9e44 <+260>:   pop    %edi
   0xf01d9e45 <+261>:   pop    %ebx
   0xf01d9e46 <+262>:   pop    %ebp
   0xf01d9e47 <+263>:   ret    
End of assembler dump.
Stack level 0, frame at 0xff9dcca0:
 eip = 0xf01d9d60 in SourceHook::CPageAlloc::Free(void*); saved eip = 0xf01dac90
 called by frame at 0xff9dccc0
 Arglist at 0xff9dcc98, args: 
 Locals at 0xff9dcc98, Previous frame's sp is 0xff9dcca0
 Saved registers:
  ebx at 0xff9dcc94, ebp at 0xff9dcc98, esi at 0xff9dcc8c, edi at 0xff9dcc90, eip at 0xff9dcc9c
End of Source crash report
----------------------------------------------