Repository navigation
Conversation
…ances The monitor's session migration checks used unanchored pgrep/pkill patterns. With multiple instances under one user where one session name is a prefix of another (e.g. vhserver and vhserver-2), the shorter instance's "old type tmux session" check matched the other instance's concurrently running pgrep command line, causing spurious restarts whenever both monitors ran at the same time. Anchor the patterns to the start of the command line and require the session name to be followed by a space or end of line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
fn_monitor_check_sessionuses unanchoredpgrep -f/pkill -fpatterns for the v23.5.0 migration checks. When several instances run under the same user and one session name is a prefix of another (the standard multi-instance naming, e.g.vhserverandvhserver-2), the shorter instance's "old type tmux session" check:matches the command line of the other instance's monitor running the same check concurrently:
So whenever both monitors run at the same moment (typical with identical
*/5cron entries), the first instance logsPIDS with old type tmux session are runningand is restarted. Only the instance with the shorter name is affected, which matches the reports in #4575.This PR anchors both migration patterns to the start of the command line and requires the session name to be followed by a space or end of line (
^tmux ... -s ${sessionname}( |$)). Genuine old-style sessions still match;pgrepprocesses and other instances no longer do.Fixes #4575
Type of change
Testing
vhserverandvhserver-2(same user,*/5monitor cron each): 162 of 2303vhservermonitor runs logged the spurious "old type tmux session" error and restarted the server;vhserver-2had zero.grep -E:pgrep -fc -u vhserver tmux new-session -d -x 80 -y 23 -s vhserver-2→ old: match, new: no matchtmux -L vhserver-2-f1b0cb57 new-session -d -x 80 -y 23 -s vhserver-2 ./valheim...→ no match (both)tmux new-session -d -x 80 -y 23 -s vhserver ./valheim...(genuine old-type session) → match (both)bash -n lgsm/modules/command_monitor.shRisk and rollback
Breaking changes
Documentation impact
Checklist
PR will not be merged until all steps are complete.
🤖 Generated with Claude Code