[Bug]: monitor does not detect updates started with the `u` short alias
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- bash
- Domain
- cli
Research direction
The check lives in fn_monitor_check_update in lgsm/modules/command_monitor.sh, around line 168. The alias list is defined in core_getopt.sh (cmd_update="u;update"), and the process match in that function only covers the long names. Reproduce by running fn_monitor_check_update with update.lock present while a process whose command line is /bin/bash ./testserver u is running. Done when u gets the same SKIP result as update and the existing update, validate and restart checks still pass.
Written by the indexing model from the issue text.
Description
Severity
severity: medium
Reproducibility
reproducible: always
Regression
regression: no
Affects latest release
latest-release: yes
User story
As a game server administrator, I want monitor to leave my server alone while an update started with ./gameserver u is running, so that it does not restart the server in the middle of the update.
Script name
Any (e.g. vhserver)
Game
Any (not game specific)
Linux distro
Other
Command
command: monitor, command: update
Expected behavior
While ./gameserver u is running and lock/update.lock exists, monitor prints Checking update: LinuxGSM is updating the game server and exits, as it already does for ./gameserver update.
Actual behavior
Monitor does not detect the update and continues. Because the update has stopped the server, fn_monitor_check_session reports Checking session: FAIL, sends a monitor-session alert and runs command_restart.sh, which starts the server while SteamCMD is still updating it.
Further information
core_getopt.sh defines the update command as cmd_update=("u;update" ...), so ./gameserver u and ./gameserver update run the same update.
fn_monitor_check_update in lgsm/modules/command_monitor.sh (line 168) only skips monitoring when update.lock exists and an update process is found with pgrep -fcx. It checks the command lines for update, validate, v, force-update, fu, update-restart and ur, but not for u. pgrep -x needs an exact match, so /bin/bash ./gameserver u is not found, pgrep returns 0 and the update lock is ignored.
During a SteamCMD update that has to stop the server, update_steamcmd.sh calls command_stop.sh with exitbypass=1. The stop keeps ${selfname}-monitoring.lock because the first command is UPDATE, not STOP. The next monitor run (cron, typically every 5 minutes) therefore gets past the lockfile check and restarts the server.
The u alias has been missing since this check was added in 9d699ee3 (2023).
Suggested fix: add || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} u")" != "0" to the condition. I will open a PR for it.
Pre-checks
- I ran update and validate before reporting this issue.
Found by reading the code on the current develop branch (28b1d67d) and reproduced with the module function itself, see the steps and output below.
Relevant log output
# fn_monitor_check_update from develop (28b1d67d), update.lock present,
# while "/bin/bash ./testserver <command>" is running:
command result
update SKIP (update detected)
u CONTINUE (monitor proceeds) <-- bug
validate SKIP (update detected)
v SKIP (update detected)
force-update SKIP (update detected)
fu SKIP (update detected)
update-restart SKIP (update detected)
ur SKIP (update detected)
Steps to reproduce
- Install any SteamCMD game server (e.g.
vhserver) and start it, so the monitoring lockfile exists. - Run
./vhserver uwhile an update is available, so the server gets stopped for the update. - While SteamCMD is still downloading, run
./vhserver monitor(or let the monitor cron job run). - Monitor reports
Checking session: FAIL, sends amonitor-sessionalert and restarts the server during the update. - Repeat with
./vhserver update: monitor reportsChecking update: LinuxGSM is updating the game serverand exits.
🤖 Generated with Claude Code
- Dominant language
- Shell
- Stars
- 4.9k
- Forks
- 863
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 45
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GameServerManagers/LinuxGSM
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
GameServerManagers/LinuxGSM#4956 ·
Maintainers usually reply within 1 day
-
[iosserver] IOSoccer moved to a 64-bit server, srcds_run no longer existsPossibly taken A pull request linked to this issue is open or already merged. Openengine: source game: IOSoccer info: dependency info: query type: bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
GameServerManagers/LinuxGSM#5023 ·
Maintainers usually reply within 1 day
-
command: monitor type: feature
Difficulty 3/5 Half a day Newbie friendliness 42/100
GameServerManagers/LinuxGSM#4995 ·
Maintainers usually reply within 1 day
-
type: feature
Difficulty 3/5 Half a day Newbie friendliness 45/100
GameServerManagers/LinuxGSM#4994 ·
Maintainers usually reply within 1 day
-
command: console distro: Debian info: website regression: yes reproducible: always severity: medium type: bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
GameServerManagers/LinuxGSM#4962 · 1 comment ·
Maintainers usually reply within 1 day
All issues in GameServerManagers/LinuxGSM
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
components-web-app/docs#228 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
int-brain-lab/iblscripts#127 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ValveSoftware/SteamOS#2927 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
msys2/MSYS2-packages#6813 ·
Maintainers usually reply within 1 day
-
Laptop display stays disabled after unplugging external monitor: FALLBACK output counted as externalPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day