From de12c1fada2f632e1eaa6c71e2adf802f46e8c93 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Sun, 19 Jul 2026 17:20:09 -0400 Subject: [PATCH] Widen unraid-api key lookup timeout to stop false "renewed" alarms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Measured live: the apikey --name lookup takes 2.2-2.7s baseline with the system idle, against a 5s timeout that left almost no margin. Load spikes (confirmed correlated with resource_watchdog pressure events in the same log window) pushed it over 5s, and the script couldn't distinguish "timed out" from "genuinely missing" — it fell through to the create path and logged a false renewal every time, even though the on-disk key file's timestamp never actually changed. Bumped to 15s for real headroom. --- .../unraid/System_Essentials/unraid_api_key_renew.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Plugin/unraid/System_Essentials/unraid_api_key_renew.sh b/Plugin/unraid/System_Essentials/unraid_api_key_renew.sh index 8544e19..f30871e 100755 --- a/Plugin/unraid/System_Essentials/unraid_api_key_renew.sh +++ b/Plugin/unraid/System_Essentials/unraid_api_key_renew.sh @@ -86,8 +86,16 @@ fi # Check if key already exists in the unraid-api registry before creating. # --overwrite generates a new key value every time, invalidating the old one. # Only renew if the registry has lost it. +# +# Timeout was 5s — measured live 2026-07-19 at 2.2-2.7s baseline latency for this +# exact command with the system idle, leaving almost no margin. Any load spike +# (confirmed correlated with resource_watchdog "pressure escalating" events in the +# same log) pushed it past 5s, killing the lookup — the script then couldn't tell +# "timed out" from "genuinely not in the registry" and fell through to the create +# path, logging a false "API key renewed (registry had lost it)" even though the +# on-disk key file's timestamp never actually changed. 15s gives real headroom. log "Checking unraid-api registry for $KEY_NAME..." -EXISTING=$(timeout 5 /usr/local/sbin/unraid-api apikey --name "$KEY_NAME" --json /dev/null) +EXISTING=$(timeout 15 /usr/local/sbin/unraid-api apikey --name "$KEY_NAME" --json /dev/null) KEY=$(echo "$EXISTING" | jq -r '.key // empty' 2>/dev/null) if [[ -n "$KEY" ]]; then