[Bug]: monitor does not detect updates started with the `u` short alias
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- bash
- Lĩnh vực
- cli
Hướng nghiên cứu
Kiểm tra nằm trong fn_monitor_check_update ở lgsm/modules/command_monitor.sh, khoảng dòng 168. Danh sách alias được định nghĩa trong core_getopt.sh (cmd_update="u;update"), và phần so khớp tiến trình trong hàm đó chỉ bao phủ các tên dài. Để tái hiện, chạy fn_monitor_check_update khi update.lock tồn tại và có một tiến trình với dòng lệnh /bin/bash ./testserver u đang chạy. Hoàn thành khi u nhận cùng kết quả SKIP như update, và các kiểm tra update, validate và restart hiện có vẫn pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Shell
- Star
- 4.9k
- Fork
- 870
- Merge trung bình
- 14 giờ 50 phút
- Pull request đã merge (30 ngày)
- 109
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của GameServerManagers/LinuxGSM
-
command: start engine: unity3d game: Assetto Corsa priority: high scope: single game type: feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
GameServerManagers/LinuxGSM#5099 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
engine: source game: Team Fortress 2 game: Team Fortress 2 Classified info: docker info: steamcmd type: bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
GameServerManagers/LinuxGSM#5094 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type: bug
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 42/100
GameServerManagers/LinuxGSM#5048 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
engine: unity3d engine: unreal4 Epic game: 7 Days to Die game: ARK: Survival Evolved game: Rust info: dependency type: feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 8/100
GameServerManagers/LinuxGSM#5047 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
command: monitor type: feature
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 42/100
GameServerManagers/LinuxGSM#4995 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của GameServerManagers/LinuxGSM
Issue tương tự
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
alunduil/alunduil-chezmoi#1002 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Page request: ssimulacra2Đang mởhelp wanted new command
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
tldr-pages/tldr#24864 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:ci priority:low type:chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
crazy-goat/php-fpm-ng#1021 ·
Maintainer thường phản hồi trong vòng 1 ngày