Say that the rsync count file is a cache the live-PID scan overwrites, so a stale value stops reading as a leak

This commit is contained in:
Gmer4Lfe
2026-08-16 21:49:58 -04:00
parent 5bdf3bff60
commit 39dba3f8ab
+5
View File
@@ -1807,6 +1807,11 @@ if [[ -n "${STATE_DIR:-}" ]] && [[ ! -d "$STATE_DIR" ]]; then
mkdir -p "$STATE_DIR" 2>/dev/null || true mkdir -p "$STATE_DIR" 2>/dev/null || true
fi fi
# A cache, not a ledger. Nothing decrements it — acquire_rsync_lock() recounts live PIDs from the
# rsync_*.lock files and overwrites this with the truth before enforcing the limit, so the file
# routinely sits at a stale non-zero value with no rsync running. That is expected, not a leak:
# killed transfers cannot wedge the limit, because a lock whose PID is dead is not counted.
# Read it as "what the last acquire saw", never as "how many are running now".
RSYNC_COUNT_FILE="$LOCK_DIR/rsync_active_count" RSYNC_COUNT_FILE="$LOCK_DIR/rsync_active_count"
RSYNC_MAX_CONCURRENT=3 RSYNC_MAX_CONCURRENT=3
LOCK_WARN_AGE=300 # seconds — warn if lock older than this (5min default) LOCK_WARN_AGE=300 # seconds — warn if lock older than this (5min default)