mirror of
https://github.com/GameServerManagers/LinuxGSM.git
synced 2026-04-24 21:56:01 +03:00
[GH-ISSUE #4575] [Bug]: cs2server. Monitor will fail when server is actually on. Then it will send quit and restart server. #2847
Labels
No labels
Atomic
Epic
cannot reproduce
command: backup
command: console
command: debug
command: details
command: fast-dl
command: install
command: mods
command: monitor
command: post-details
command: restart
command: send
command: start
command: stop
command: update
command: update-lgsm
command: validate
command: wipe
distro: AlmaLinux
distro: Arch Linux
distro: CentOS
distro: Debian
distro: Fedora
distro: RedHat
distro: Rocky Linux
distro: Ubuntu
distro: openSUSE
engine: goldsrc
engine: source
game: 7 Days to Die
game: ARMA 3
game: Ark: Survival Evolved
game: Assetto Corsa
game: Avorion
game: BATTALION: Legacy
game: Barotrauma
game: Battalion 1944
game: Battlefield 1942
game: Black Mesa: Deathmatch
game: Blade Symphony
game: Call of Duty 2
game: Call of Duty 4
game: Call of Duty: United Offensive
game: Counter-Strike 1.6
game: Counter-Strike 2
game: Counter-Strike: Global Offensive
game: Counter-Strike: Source
game: Day of Infamy
game: Dayz
game: Death Match Classic
game: Don't Starve Together
game: ET: Legacy
game: Eco
game: Factorio
game: Factorio
game: Garry's Mod
game: Half-Life
game: Hurtword
game: Insurgecy
game: Insurgecy
game: Insurgency: Sandstorm
game: Just Cause 3
game: Killing Floor
game: Killing Floor 2
game: Left 4 Dead 2
game: Minecraft
game: Minecraft Bedrock
game: Mordhau
game: Multi Theft Auto
game: Mumble
game: Natural Selection 2
game: No More Room in Hell
game: Pavlov VR
game: Post Scriptum
game: Project Zomboid
game: Quake 3
game: QuakeWorld
game: Red Orchestra: Ostfront 41-45
game: Return to Castle Wolfenstein
game: Rising World
game: Rust
game: San Andreas Multiplayer
game: Satisfactory
game: Soldat
game: Soldier of Fortune 2
game: Squad
game: Squad 44
game: Starbound
game: Stationeers
game: Sven Co-op
game: Team Fortress 2
game: Teamspeak 3
game: Teeworlds
game: Terraria
game: The Front
game: Unreal Tournament 2004
game: Unreal Tournament 3
game: Unreal Tournament 99
game: Unturned
game: Valheim
game: Wurm Unlimited
game: Zombie Master Reborn
game: label missing
good first issue
help wanted
info: alerts
info: dependency
info: docker
info: docs
info: email
info: query
info: steamcmd
info: systemd
info: tmux
info: website
info: website
needs more info
outcome: duplicate
outcome: issue resolved
outcome: issue resolved
outcome: issue unresolved
outcome: pr accepted
outcome: pr rejected
outcome: unconfirmed
outcome: wontfix
outcome: wrong forum
potential-duplicate
priority
pull-request
type: bug
type: feature
type: feature
type: feature request
type: game server request
type: refactor
waiting response
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/LinuxGSM#2847
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tk1114632 on GitHub (May 10, 2024).
Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/4575
User story
Need help to fix.
Game
cs2server
Linux distro
Ubuntu 22.04
Command
command: monitor
Further information
Monitor will fail when server is actually on. Then it will send quit and restart server.
Log shows: "PIDS with old type tmux session are running." What is it meaning?
Relevant log output
Steps to reproduce
@vg2808 commented on GitHub (Aug 18, 2024):
I also came across such a mistake.. Any fix?
@mayersgamer commented on GitHub (Nov 8, 2024):
me too , server restart with same error when using 2 instances with the same installation
i have set monitor to verify every 2 minutes so i think i will remove it because its causing the restart.
Nov 08 17:34:07.865 cs2server: MONITOR: PASS: Querying port: gsquery: 31.56.0.68:27015 : 1 : OK
Nov 08 17:34:07.869 cs2server: MONITOR: INFO: LinuxGSM version: v24.3.2
Nov 08 17:34:07.871 cs2server: MONITOR: PASS: core_exit.sh exiting with code: 0
Nov 08 17:36:02.697 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:36:03.592 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:36:05.148 cs2server: MONITOR: INFO: Checking session: CHECKING
Nov 08 17:36:05.361 cs2server: MONITOR: PASS: Checking session: OK
Nov 08 17:36:05.363 cs2server: MONITOR: INFO: gamedig is not installed
Nov 08 17:36:05.364 cs2server: MONITOR: INFO: https://docs.linuxgsm.com/requirements/gamedig
Nov 08 17:36:06.868 cs2server: MONITOR: INFO: Querying port: gsquery: 31.56.0.68:27015 : 1 : QUERYING
Nov 08 17:36:07.092 cs2server: MONITOR: PASS: Querying port: gsquery: 31.56.0.68:27015 : 1 : OK
Nov 08 17:36:07.097 cs2server: MONITOR: INFO: LinuxGSM version: v24.3.2
Nov 08 17:36:07.099 cs2server: MONITOR: PASS: core_exit.sh exiting with code: 0
Nov 08 17:38:02.009 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:38:03.204 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:38:04.757 cs2server: MONITOR: INFO: Checking session: CHECKING
Nov 08 17:38:04.971 cs2server: MONITOR: PASS: Checking session: OK
Nov 08 17:38:04.974 cs2server: MONITOR: INFO: gamedig is not installed
Nov 08 17:38:04.976 cs2server: MONITOR: INFO: https://docs.linuxgsm.com/requirements/gamedig
Nov 08 17:38:06.481 cs2server: MONITOR: INFO: Querying port: gsquery: 31.56.0.68:27015 : 1 : QUERYING
Nov 08 17:38:06.705 cs2server: MONITOR: PASS: Querying port: gsquery: 31.56.0.68:27015 : 1 : OK
Nov 08 17:38:06.711 cs2server: MONITOR: INFO: LinuxGSM version: v24.3.2
Nov 08 17:38:06.712 cs2server: MONITOR: PASS: core_exit.sh exiting with code: 0
Nov 08 17:40:02.818 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:40:03.542 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:40:05.094 cs2server: MONITOR: INFO: Checking session: CHECKING
Nov 08 17:40:05.309 cs2server: MONITOR: PASS: Checking session: OK
Nov 08 17:40:05.311 cs2server: MONITOR: INFO: gamedig is not installed
Nov 08 17:40:05.313 cs2server: MONITOR: INFO: https://docs.linuxgsm.com/requirements/gamedig
Nov 08 17:40:06.816 cs2server: MONITOR: INFO: Querying port: gsquery: 31.56.0.68:27015 : 1 : QUERYING
Nov 08 17:40:07.042 cs2server: MONITOR: PASS: Querying port: gsquery: 31.56.0.68:27015 : 1 : OK
Nov 08 17:40:07.048 cs2server: MONITOR: INFO: LinuxGSM version: v24.3.2
Nov 08 17:40:07.049 cs2server: MONITOR: PASS: core_exit.sh exiting with code: 0
Nov 08 17:42:02.083 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:42:02.790 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:42:04.339 cs2server: MONITOR: INFO: Checking session: CHECKING
Nov 08 17:42:04.552 cs2server: MONITOR: PASS: Checking session: OK
Nov 08 17:42:04.554 cs2server: MONITOR: INFO: gamedig is not installed
Nov 08 17:42:04.555 cs2server: MONITOR: INFO: https://docs.linuxgsm.com/requirements/gamedig
Nov 08 17:42:06.059 cs2server: MONITOR: INFO: Querying port: gsquery: 31.56.0.68:27015 : 1 : QUERYING
Nov 08 17:42:06.281 cs2server: MONITOR: PASS: Querying port: gsquery: 31.56.0.68:27015 : 1 : OK
Nov 08 17:42:06.286 cs2server: MONITOR: INFO: LinuxGSM version: v24.3.2
Nov 08 17:42:06.287 cs2server: MONITOR: PASS: core_exit.sh exiting with code: 0
Nov 08 17:44:02.767 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:44:03.501 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:44:05.052 cs2server: MONITOR: INFO: Checking session: CHECKING
Nov 08 17:44:05.266 cs2server: MONITOR: PASS: Checking session: OK
Nov 08 17:44:05.268 cs2server: MONITOR: INFO: gamedig is not installed
Nov 08 17:44:05.270 cs2server: MONITOR: INFO: https://docs.linuxgsm.com/requirements/gamedig
Nov 08 17:44:06.773 cs2server: MONITOR: INFO: Querying port: gsquery: 31.56.0.68:27015 : 1 : QUERYING
Nov 08 17:44:06.999 cs2server: MONITOR: PASS: Querying port: gsquery: 31.56.0.68:27015 : 1 : OK
Nov 08 17:44:07.003 cs2server: MONITOR: INFO: LinuxGSM version: v24.3.2
Nov 08 17:44:07.005 cs2server: MONITOR: PASS: core_exit.sh exiting with code: 0
Nov 08 17:46:01.875 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:46:02.541 cs2server: MONITOR: PASS: Using cached IP as public IP address
Nov 08 17:46:04.095 cs2server: MONITOR: INFO: Checking session: CHECKING
Nov 08 17:46:04.309 cs2server: MONITOR: ERROR: Checking session: ERROR
Nov 08 17:46:04.310 cs2server: MONITOR: ERROR: Checking session: PIDS with old type tmux session are running
Nov 08 17:46:04.312 cs2server: MONITOR: ERROR: Checking session: Killing session with the session name cs2server
Nov 08 17:46:04.389 cs2server: RESTART: PASS: Using cached IP as public IP address
Nov 08 17:46:04.998 cs2server: STOP: PASS: Using cached IP as public IP address
Nov 08 17:46:05.567 cs2server: STOP: PASS: Using cached IP as public IP address
Nov 08 17:46:06.107 cs2server: STOP: INFO: Graceful: sending "quit"
Nov 08 17:46:10.819 cs2server: STOP: PASS: Graceful: sending "quit
Nov 08 17:46:11.820 cs2server: START: PASS: Using cached IP as public IP address
Nov 08 17:46:11.869 cs2server: START: INFO: Using anonymous Steam login
Nov 08 17:46:12.066 cs2server: START: PASS: Using cached IP as public IP address
Nov 08 17:46:12.614 cs2server: START: INFO: Rotating log files
crontab :
*/2 * * * * /home/server1/cs2server monitor > /dev/null 2>&1
*/30 * * * * /home/server1/cs2server update > /dev/null 2>&1
0 0 * * 0 /home/server1/cs2server update-lgsm > /dev/null 2>&1
@reboot /home/server1/cs2server start > /dev/null 2>&1
0 6 * * * /home/server1/cs2server restart > /dev/null 2>&1
*/2 * * * * /home/server1/cs2server-2 monitor > /dev/null 2>&1
*/30 * * * * /home/server1/cs2server-2 update > /dev/null 2>&1
@reboot /home/server1/cs2server-2 start > /dev/null 2>&1
0 6 * * * /home/server1/cs2server-2 restart > /dev/null 2>&1
ok maybe it was happning before when i had 2 servers with 2 diffrent users and diffrent instalation i used to see steamgamemanagment token key being refreshed 2-3 times a day and it shoudnt because i set the servers to restart only at 6 am every day .
so i think monitor failled to monitor and leads the servers to quit and restart .
im going to try for monitor once every hour and see if steam game manager token will refresh the token of my servers outside the sheduled time for restart.
@MrLenin commented on GitHub (Jan 4, 2025):
I have run into this issue as well monitoring multiple factorio server instances from a single install. With a single instance everything works fine indefinitely, but as soon as you monitor a second instance, it will fail and restart anywhere between 5 minutes and 2 hours over and over again.
I found it interesting this seemed to only affect the first server, the second server never experienced the issue even once over weeks.
I added some additional logging to the monitor script to see what the expanded pgrep command is and the value of its output and they are exactly what you would expect for this error to occur.
I am reasonably sure at this point that the issue almost exclusively affects unnumbered instances in a multi-instance setup where the pgrep expression for the unnumbered instance can match on the command lines for the pgrep's being run for the monitoring of additional instances.
I am testing a modified version of the monitoring module where the problematic pgrep expression has been modified to add a '^' to the beginning to ensure it is explicitly matching the start of command line, I suspect this will resolve the problem.
It may be a good idea to repeat this for other applicable pgreps in the codebase if it is found to correct this problem.
@MrLenin commented on GitHub (Jan 4, 2025):
It hasn't quite been two hours yet since the last restart (4:20:17 EST), but I am feeling reasonably confident at this point my change resolves the underlying issue.
It should be noted perhaps that my suggested fix might not work in the hopefully uncommon situation where the monitor module is able to see instances across multiple users.
@h3o66 commented on GitHub (Jan 4, 2025):
Witch crontab do you mean with this one ?
The user crontab via
crontab -eor maybe/etc/crontab?@MrLenin commented on GitHub (Jan 4, 2025):
I have only used the user crontab.
Change line 204 of
~/lgsm/modules/command_monitor.shfromelif [ "$(pgrep -fc -u "${USER}" "tmux new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; thentoelif [ "$(pgrep -fc -u "${USER}" "^tmux new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; thenthis should resolve this and only this specific problem, but it could potentially reoccur with any other pgrep expression that isn't explicitly matching against that beginning of the command line
Over three hours without a restart now.
@MrLenin commented on GitHub (Jan 4, 2025):
Thinking about this some more, while my change does fix this particular issue, the code is still ultimately bugged as it would still trigger on the unnumbered instance for any numbered instance with a tmux launched using the old parameters, so it doesn't work as intended even.
@execut4ble commented on GitHub (Mar 10, 2025):
I am also replicating this with multiple instances of hldmserver. With the following cronjob the server is being restarted very frequently even though it's running:
The script log file reveals that the monitor is failing:
Looking for a fix for this as well
@tk1114632 commented on GitHub (Nov 3, 2025):
More info about the bug behavior:
As showed in the screenshot, the restarts started at around 10:00 am local time, and stopped around 23:48 pm.
@tk1114632 commented on GitHub (Nov 3, 2025):
Probably found the cause:
In command_monirot.sh:
elif [ "$(pgrep -fc -u "${USER}" "tmux new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; then
fn_print_error "Checking session: PIDS with old type tmux session are running: "
fn_script_log_error "Checking session: ERROR"
fn_script_log_error "Checking session: PIDS with old type tmux session are running"
fn_script_log_error "Checking session: Killing session with the session name ${sessionname}"
pkill -f "tmux new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}"
command_restart.sh
core_exit.sh
If you name instances with like cs2server, cs2server-2, cs2server-3, the first instance will launch tmux naming as "tmux new-session -d -x 80 -y 23 -s cs2server-xxxxxxx", while the second being "tmux new-session -d -x 80 -y 23 -s cs2server-2-xxxxxxxxx". The monitor would probably match the second instance tmux window, which finally leads to the error.
@rtxa commented on GitHub (Dec 10, 2025):
So, what naming scheme should be used instead as a workaround? Having the same issue with multiple instances of hldmserver, hldmserver1, etc.