YaLTeR / OpenAG

An open-source reimplementation of Adrenaline Gamer's client library.
https://j.mp/OpenAG
Other
131 stars 42 forks source link

[Linux] _restart crashes the game on Linux #140

Open chinese-soup opened 3 years ago

chinese-soup commented 3 years ago

We all know this happens, but let's not forget about it and maybe eventually fix it, since HL1 client DLL doesn't have this issue (discord integration related maybe?).

Pretty useless ST:

#1  0xf4b07d41 in Cvar_RegisterVariable (variable=0xf4ce5e60 <voice_loopback>) at ../engine/cvar.c:458
#2  0xf4bfa3bf in Voice_RegisterCvars () at ../engine/voice.cpp:338
#3  0xf4b181dd in Host_Init (parms=0xf536b984 <host_parms>) at ../engine/host.c:1810
#4  0xf4b42177 in Sys_InitGame (
    lpOrgCmdLine=0x9a0cb40 "/home/unko/.local/share/Steam/steamapps/common/Half-Life/hl_linux -steam -game ag -condebug -dev -console -novid 0 ", pBaseDir=0x804b220 <szBaseDir> "/home/unko/.local/share/Steam/steamapps/common/Half-Life", pwnd=0xf5361768 <g_Game+8>, 
    bIsDedicated=0) at ../engine/sys_dll2.cpp:803
#5  0xf4b44baa in CEngine::Load (this=0xf4d5eaa0 <g_Engine>, dedicated=false, 
    basedir=0x804b220 <szBaseDir> "/home/unko/.local/share/Steam/steamapps/common/Half-Life", 
    cmdline=0x9a0cb40 "/home/unko/.local/share/Steam/steamapps/common/Half-Life/hl_linux -steam -game ag -condebug -dev -console -novid 0 ") at ../engine/sys_engine.cpp:193
#6  0xf4b42570 in RunListenServer (instance=0x0, basedir=0x804b220 <szBaseDir> "/home/unko/.local/share/Steam/steamapps/common/Half-Life", 
    cmdline=0x9a0cb40 "/home/unko/.local/share/Steam/steamapps/common/Half-Life/hl_linux -steam -game ag -condebug -dev -console -novid 0 ", postRestartCmdLineArgs=0x804d360 <main::szNewCommandParams> "", launcherFactory=0x8049350 <CreateInterfaceLocal(char const*, int*)>, 
    filesystemFactory=0xf5d7fd40 <CreateInterface(char const*, int*)>) at ../engine/sys_dll2.cpp:934
#7  0x08048d67 in main (argc=8, argv=0xfff3bc64) at ../launcher/launcher.cpp:439
tmp64 commented 3 years ago

Same crash with same stack trace with BugfixedHL. Probably not caused by discord-rpc directly.

Maybe dlclose(client module) call doesn't actually unload the client library, so after engine restart it reuses previously loaded library?

chinese-soup commented 2 years ago

Hm, different stack trace :thinking:

hl_linux: /home/unko/repos/OpenAG/pm_shared/pm_shared.c:3364: PM_Init: Assertion `!pm_shared_initialized' failed.

#0  0xf7eea549 in __kernel_vsyscall ()
#1  0xf7ae66e8 in raise () from /usr/lib32/libc.so.6
#2  0xf7acf407 in abort () from /usr/lib32/libc.so.6
#3  0xf7acf2d9 in __assert_fail_base.cold () from /usr/lib32/libc.so.6
#4  0xf7ade9bd in __assert_fail () from /usr/lib32/libc.so.6
#5  0xc9a24b9b in PM_Init (ppmove=0xf6db4b60 <g_clmove>) at /home/unko/repos/OpenAG/pm_shared/pm_shared.c:3364
#6  0xc9980ac1 in HUD_PlayerMoveInit (ppmove=0xf6db4b60 <g_clmove>) at /home/unko/repos/OpenAG/cl_dll/cdll_int.cpp:137
#7  0xf636fcfa in ClientDLL_ClientMoveInit (ppmove=<optimized out>) at ../engine/cdll_int.c:967
#8  ClientDLL_Init () at ../engine/cdll_int.c:462
#9  0xf62d13f0 in Host_Init (parms=0xf6b24984 <host_parms>) at ../engine/host.c:1917
#10 0xf62fb177 in Sys_InitGame (lpOrgCmdLine=0x9a622c0 "./hl_linux -steam -game ag -novid 0 ", pBaseDir=0x804b220 <szBaseDir> ".", pwnd=0xf6b1a768 <g_Game+8>, bIsDedicated=0) at ../engine/sys_dll2.cpp:803
#11 0xf62fdbaa in CEngine::Load (this=0xf6517aa0 <g_Engine>, dedicated=false, basedir=0x804b220 <szBaseDir> ".", cmdline=0x9a622c0 "./hl_linux -steam -game ag -novid 0 ") at ../engine/sys_engine.cpp:193
#12 0xf62fb570 in RunListenServer (instance=0x0, basedir=0x804b220 <szBaseDir> ".", cmdline=0x9a622c0 "./hl_linux -steam -game ag -novid 0 ", postRestartCmdLineArgs=0x804d360 <main::szNewCommandParams> "", launcherFactory=
    0x8049350 <CreateInterfaceLocal(char const*, int*)>, filesystemFactory=0xf7538d40 <CreateInterface(char const*, int*)>) at ../engine/sys_dll2.cpp:934
#13 0x08048d67 in main (argc=4, argv=0xff8f9ce4) at ../launcher/launcher.cpp:439
tmp64 commented 2 years ago

Really looks like client.so wasn't unloaded so ClientDLL_Init triggered the assertion assert( !pm_shared_initialized );