dasisdormax / cs2-multiserver

Managing multiple CS2 Servers with ease
Apache License 2.0
57 stars 10 forks source link

Stopping one instance closes all instances #23

Closed Tastefull closed 8 months ago

Tastefull commented 8 months ago

Hi,

I have 2 instances set up:

If i start both them using cs2-server @gr1-15 start and cs2-server @gr1-16 start they both run fine. But if do either cs2-server @gr1-15 stop or cs2-server @gr1-16 stop, both instances closes.

dasisdormax commented 8 months ago

I can't reproduce the issue. Do the logs show what happened to the other instance, that was supposed to keep running?

Tastefull commented 8 months ago

cs2-server @gr1-15 start cs2-server @gr1-16 start cs2-server @gr1-15 stop tail -n100 log/inst-gr1-15/240226_13\:01\:39-controller.log

====================================================================

                   **MSM Server Control**
                   ----------------------

Current time: Mon Feb 26 01:01:39 PM UTC 2024 Log file: /home/cs/msm.d/cs2/log/inst-gr1-15/240226_13:01:39-controller.log

====================================================================

INFO: in main ( 40) This program will control the cs2 server and react to events such as server crashes, pending updates and user commands. DEBUG: in main ( 146) Current State: >>> LAUNCHING INFO: in main ( 100) Launching cs2 server ... DEBUG: in main ( 146) Current State: >>> RUNNING INFO: in main ( 109) Stopping ... DEBUG: in App::killServer ( 136) in try ( 65) in Core.Wrapper::killServer ( 80) in Core.Wrapper::shutdownServer ( 75) in main ( 110) Killing server with pid = 121475 ... INFO: in main ( 150) Server Stopped. Exiting ...

tail -n100 log/inst-gr1-16/240226_13\:02\:24-controller.log

====================================================================

                   **MSM Server Control**
                   ----------------------

Current time: Mon Feb 26 01:02:24 PM UTC 2024 Log file: /home/cs/msm.d/cs2/log/inst-gr1-16/240226_13:02:24-controller.log

====================================================================

INFO: in main ( 40) This program will control the cs2 server and react to events such as server crashes, pending updates and user commands. DEBUG: in main ( 146) Current State: >>> LAUNCHING INFO: in main ( 100) Launching cs2 server ... DEBUG: in main ( 146) Current State: >>> RUNNING INFO: in main ( 124) Server exited with exit code 0. DEBUG: in main ( 146) Current State: >>> STOPPED INFO: in main ( 150) Server Stopped. Exiting ...

tail -n100 log/inst-gr1-15/240226_13\:01\:39-server.log

quit CHostStateMgr::QueueNewRequest( Quitting, 3 ) HostStateRequest::Start(HSR_QUIT) SV: Server shutting down: NETWORK_DISCONNECT_EXITING (59) CNetworkGameServerBase::SetServerState (ss_active -> ss_dead) CSteam3ServerS1::ShutdownGameServer CNetworkSystem::ShutdownGameServer Closing 'server' UDP listen socket SteamNetworkingSockets lock held for 6.3ms. (Performance warning.) CloseListenSocket,IRawUDPSocket::Close This is usually a symptom of a general performance problem such as thread starvation. Closing 'server' poll group CNetworkSystem::CleanupDebugOutputFunction() CSource2Server::GameServerSteamAPIDeactivated() SV: IGameSystem::LoopDeactivateAllSystems { [S_API FAIL] Tried to access Steam interface SteamUtils010 before SteamAPI_Init succeeded. HO: IGameSystem::LoopDeactivateAllSystems { HO: } IGameSystem::LoopDeactivateAllSystems done SV: } IGameSystem::LoopDeactivateAllSystems done SV: CNetworkStringTableContainer::RemoveAllTables: removing 12 tables CL: CNetworkStringTableContainer::RemoveAllTables: removing 12 tables SV: CGameRulesGameSystem::GameShutdown uninstalled game rules SV: CGameRules::CGameRules destructed Host activate: Quitting Dispatching EventAppShutdown_t { Requested non-existent write path USRLOCAL! Requested non-existent write path USRLOCAL! Error writing user config file 'cfg/cs2_user_keys_0_slot0.vcfg' Requested non-existent write path USRLOCAL! Requested non-existent write path USRLOCAL! Requested non-existent write path USRLOCAL! Error writing user config file 'cfg/cs2_user_convars_0_slot0.vcfg' } Dispatched EventAppShutdown_t MainLoop returning Source2Shutdown ShutdownSource2Logging CNetworkSystem::Shutdown() CNetworkSystem::CloseAllSockets() Forgot to remove resource type manager for type vpost! Forgot to remove resource type manager for type vpcf! Forgot to remove resource type manager for type vsnap!

Script done on 2024-02-26 13:04:40+00:00 [COMMAND_EXIT_CODE="139"]

tail -n100 log/inst-gr1-16/240226_13\:02\:24-server.log

SIGTERM received while server was not hibernating! Shutting down even though a game may be in progress! CHostStateMgr::QueueNewRequest( Quitting, 3 ) HostStateRequest::Start(HSR_QUIT) SV: Server shutting down: NETWORK_DISCONNECT_EXITING (59) CNetworkGameServerBase::SetServerState (ss_active -> ss_dead) CSteam3ServerS1::ShutdownGameServer CNetworkSystem::ShutdownGameServer Closing 'server' UDP listen socket SteamNetworkingSockets lock held for 6.7ms. (Performance warning.) CloseListenSocket,IRawUDPSocket::Close This is usually a symptom of a general performance problem such as thread starvation. Closing 'server' poll group CNetworkSystem::CleanupDebugOutputFunction() CSource2Server::GameServerSteamAPIDeactivated() SV: IGameSystem::LoopDeactivateAllSystems { [S_API FAIL] Tried to access Steam interface SteamUtils010 before SteamAPI_Init succeeded. HO: IGameSystem::LoopDeactivateAllSystems { HO: } IGameSystem::LoopDeactivateAllSystems done SV: } IGameSystem::LoopDeactivateAllSystems done SV: CNetworkStringTableContainer::RemoveAllTables: removing 12 tables CL: CNetworkStringTableContainer::RemoveAllTables: removing 12 tables SV: CGameRulesGameSystem::GameShutdown uninstalled game rules SV: CGameRules::CGameRules destructed Host activate: Quitting Dispatching EventAppShutdown_t { Requested non-existent write path USRLOCAL! Requested non-existent write path USRLOCAL! Error writing user config file 'cfg/cs2_user_keys_0_slot0.vcfg' Requested non-existent write path USRLOCAL! Requested non-existent write path USRLOCAL! Requested non-existent write path USRLOCAL! Error writing user config file 'cfg/cs2_user_convars_0_slot0.vcfg' } Dispatched EventAppShutdown_t MainLoop returning Source2Shutdown ShutdownSource2Logging CNetworkSystem::Shutdown() CNetworkSystem::CloseAllSockets() Forgot to remove resource type manager for type vpost! Forgot to remove resource type manager for type vpcf! Forgot to remove resource type manager for type vsnap!

Script done on 2024-02-26 13:04:41+00:00 [COMMAND_EXIT_CODE="139"]

dasisdormax commented 8 months ago

Thanks for the logs.

From the logs, it looks like both instances listen on the same port.

Can you check the files ~/msm.d/cs2/cfg/inst-gr1-15/server.conf and ~/msm.d/cs2/cfg/inst-gr1-16/server.conf? The port should be different between both files.

#~~~~ The IP Address and port to bind the server to.
#~~~~ NOTE: IP="0.0.0.0" binds to all available Network interfaces
__IP__="0.0.0.0"
__PORT__="27015"
Tastefull commented 8 months ago

Hi,

So i use LAUNCH_CMD to override the startup parameters so i didn't set the PORT so both were set to 27015 but my LAUNCHCMD does include different port (27015 and 27016). I have just tried to set the PORT to 27016 for the gr1-16 server config file, but both services still stops if i stop one of them. Right now my workaround is to send a QUIT command with the exec feature of cs2-server.

Is there a chance that because i set LAUNCH_CMD variable in server.conf there is stuff that are not set correctly? I noticed that i had to include the full path for cs2 like this ./game/bin/linuxsteamrt64/cs2 because the home directory is set to /home/cs/msm.d/cs2/inst-gr1-15 and /home/cs/msm.d/cs2/inst-gr1-16. Which is not needed if i don't use LAUNCH_CMD.

here are the start response i get from the two instances

Starting Instance @gr1-15 ... INFO: Server working directory: /home/cs/msm.d/cs2/inst-gr1-15 INFO: Server launch command: ./game/bin/linuxsteamrt64/cs2 -dedicated +map de_dust2 +game_mode 1 +game_type 0 -port 27015 +rcon_password XXXXXX -ip 192.168.1.10 +log on +sv_logecho 1 -maxplayers 10 +exec load-match.cfg SUCCESS: Instance @gr1-15 started successfully!

Use **cs2-server @gr1-15 console** to enter the game's console.

Starting Instance @gr1-16 ... INFO: Server working directory: /home/cs/msm.d/cs2/inst-gr1-16 INFO: Server launch command: ./game/bin/linuxsteamrt64/cs2 -dedicated +map de_dust2 +game_mode 1 +game_type 0 -port 27016 +rcon_password XXXXX -ip 192.168.1.10 +log on +sv_logecho 1 -maxplayers 10 +exec load-match.cfg SUCCESS: Instance @gr1-16 started successfully!

Use **cs2-server @gr1-16 console** to enter the game's console.
dasisdormax commented 8 months ago

LAUNCH_CMD is generated by the script and was never intended to be set manually. While you could launch the servers, the remaining setup does not finish normally.

Tastefull commented 8 months ago

But it is documented in the code that it can be overridden. Could you supply a way to then add variables to the LAUNCH_CMD? E.g. an EXTRA_CMD or something similar

dasisdormax commented 8 months ago

But it is documented in the code that it can be overridden.

I'd like to see that documentation ...

Could you supply a way to then add variables to the LAUNCH_CMD? E.g. an EXTRA_CMD or something similar

Extra cvars can be set in server.conf with AUTOEXEC_CUSTOM, for example

AUTOEXEC_CUSTOM=(
"mp_autokick 0"
"mp_autoteambalance 0"
"mp_freezetime 0"
"sv_airaccelerate 400"
"exec load-match.cfg"
)

If extra command line arguments are necessary (for example if setting some cvar in an autoexec file doesn't work), I am open to adding those specific ones, but I won't support arbitrary command line arguments.

Tastefull commented 8 months ago

Thanks for clarifying. I tried using the autoexec custom but didn't seem to work.

I think i can work my way around not having full control over the launch parameters. So thanks for helping out.