[GH-ISSUE #1886] Improving concurrent commands with lockfiles #1480

Open
opened 2026-02-27 02:57:21 +03:00 by kerem · 2 comments
Owner

Originally created by @UltimateByte on GitHub (Apr 18, 2018).
Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/1886

We could use more lockfiles, and these lockfiles could use timings to prevent stuff from happening too soon or at the same time (say with bad crons, or when you run a crons + the same function at the same time).

  1. Consider the server start delay

A server that was just started will not answer to queries, sometimes for a while (Rust takes ages to start, the game could be downloading workshop content, etc.). If the server is not responding for some valid reason, you do not want it to bootloop.

Regarding this:

  • Monitor could use the date of the game server instance's lockfile, so that if it was started less than 5 minutes ago (by default), it will close the monitor function after 10 seconds, unless the user types "y" to override this and runs monitor anyways.
  • We need to make sure the date is updated in case of a restart using monitor (maybe it is already the case)
  1. You don't want to run two monitor at the same time, and you'd love to restart the server as fast as possible if it does not answer to queries.
    After the first fix has been implemented, we can now add multiple improvements.
  • Monitor could have a lockfile, so two monitor cannot run at the same time
  • Since we waited for the server to be started, if it does not answer to queries, monitor does not need to wait for too long if the server is not answering to queries. The default value could be 10 seconds (10 failed queries), and we could also add a parameter for the user to increase that if his server lags a lot.
  • If a monitor lockfile is more than 5 minutes, then this is probably a residue of an interrupted monitor, and the lockfile should be removed, and monitor ran anyways.

With this in place, users could run the monitor cronjob every minute without any issues.

  1. You don't want multiple updates to run at the same time
  • Update and validate commands could use the same lockfile, used to prevent from running two times the functions at once
  • If the lockfile is more than 1h, then it should be removed and the update should run anyway.
  • Mods-update could also benefit from its lockfile.
  1. Move lockfiles checks to its own function
  • Since we are now running multiple lockfiles, it would be wise to use a check script for that purpose, for example check_lockfile.sh, which would be run using check.sh for relevant commands.
  • We should not forget FastDL command which uses a lockfile as well.
  • All these lockfiles could use the jail method that we are already using, to remove the lockfiles in case of a script interruption by the user (kill or ctrl +c).

That's all I can think about for now. If you have more ideas for lockfiles, please share.

Originally created by @UltimateByte on GitHub (Apr 18, 2018). Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/1886 We could use more lockfiles, and these lockfiles could use timings to prevent stuff from happening too soon or at the same time (say with bad crons, or when you run a crons + the same function at the same time). 1) **Consider the server start delay** A server that was just started will not answer to queries, sometimes for a while (Rust takes ages to start, the game could be downloading workshop content, etc.). If the server is not responding for some valid reason, you do not want it to bootloop. Regarding this: - Monitor could use the date of the game server instance's lockfile, so that if it was started less than 5 minutes ago (by default), it will close the monitor function after 10 seconds, unless the user types "y" to override this and runs monitor anyways. - We need to make sure the date is updated in case of a restart using monitor (maybe it is already the case) 2) **You don't want to run two monitor at the same time, and you'd love to restart the server as fast as possible if it does not answer to queries.** After the first fix has been implemented, we can now add multiple improvements. - Monitor could have a lockfile, so two monitor cannot run at the same time - Since we waited for the server to be started, if it does not answer to queries, monitor does not need to wait for too long if the server is not answering to queries. The default value could be 10 seconds (10 failed queries), and we could also add a parameter for the user to increase that if his server lags a lot. - If a monitor lockfile is more than 5 minutes, then this is probably a residue of an interrupted monitor, and the lockfile should be removed, and monitor ran anyways. With this in place, users could run the monitor cronjob every minute without any issues. 3) **You don't want multiple updates to run at the same time** - Update and validate commands could use the same lockfile, used to prevent from running two times the functions at once - If the lockfile is more than 1h, then it should be removed and the update should run anyway. - Mods-update could also benefit from its lockfile. 4) **Move lockfiles checks to its own function** - Since we are now running multiple lockfiles, it would be wise to use a check script for that purpose, for example check_lockfile.sh, which would be run using check.sh for relevant commands. - We should not forget FastDL command which uses a lockfile as well. - All these lockfiles could use the jail method that we are already using, to remove the lockfiles in case of a script interruption by the user (kill or ctrl +c). That's all I can think about for now. If you have more ideas for lockfiles, please share.
Author
Owner

@dgibbs64 commented on GitHub (Oct 27, 2018):

Happy with this suggestion and recommend it is implemented

<!-- gh-comment-id:433602766 --> @dgibbs64 commented on GitHub (Oct 27, 2018): Happy with this suggestion and recommend it is implemented
Author
Owner

@dgibbs64 commented on GitHub (Nov 25, 2019):

number 1 has been implemented. A monitor delay now exists for all servers to prevent accidental reboot with monitor.

<!-- gh-comment-id:558162826 --> @dgibbs64 commented on GitHub (Nov 25, 2019): number 1 has been implemented. A monitor delay now exists for all servers to prevent accidental reboot with monitor.
Sign in to join this conversation.
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
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/LinuxGSM#1480
No description provided.