From 345eb09559a155774a9f3c2e7f1c097e46ca5cb8 Mon Sep 17 00:00:00 2001 From: operator-main Date: Tue, 6 Oct 2026 07:28:20 +0000 Subject: [PATCH] fix(watchdog): eliminate SIGPIPE+pipefail phantom failures in health checks echo "$list" | grep -q under set -o pipefail exits 141 whenever grep matches before echo finishes writing, so healthy browsers were reported 'CDP up but no page target' and killed every 2 min fleet-wide (load 19+). Use [[ == *glob* ]] (no pipe, no race) for the page/muse.ai stages, and grep -c (reads to EOF, never early-exits) for the netns check. --- bin/chromebox-watchdog.sh | 4 ++-- bin/netvm-exec.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/chromebox-watchdog.sh b/bin/chromebox-watchdog.sh index 57db446..2c3e7e1 100755 --- a/bin/chromebox-watchdog.sh +++ b/bin/chromebox-watchdog.sh @@ -64,9 +64,9 @@ healthy() { local list list="$(cdp_list)" \ || { HEALTH_FAIL_REASON="CDP unreachable on :$CDP_PORT"; return 1; } - echo "$list" | grep -q '"type": "page"' \ + [[ "$list" == *'"type": "page"'* ]] \ || { HEALTH_FAIL_REASON="CDP up but no page target in list"; return 1; } - echo "$list" | grep -E -q '"url": "https://muse\.ai' \ + [[ "$list" == *'"url": "https://muse.ai'* ]] \ || { HEALTH_FAIL_REASON="CDP up but not on muse.ai"; return 1; } warp_egress_healthy || return 1 return 0 diff --git a/bin/netvm-exec.sh b/bin/netvm-exec.sh index 76176ad..2638b37 100755 --- a/bin/netvm-exec.sh +++ b/bin/netvm-exec.sh @@ -9,5 +9,5 @@ NODE="${1:?usage: netvm-exec.sh -- [args...]}"; shift [ "${1:-}" = "--" ] && shift [ $# -gt 0 ] || { echo "usage: netvm-exec.sh -- [args...]"; exit 1; } [ -f "/etc/netvm/${NODE}.conf" ] || { echo "no warp identity for '$NODE' (human: netvm-new-identity.sh $NODE)"; exit 1; } -ip netns list 2>/dev/null | grep -q "^warp-${NODE}" || { echo "node '$NODE' is not up (netvm-node-up.sh $NODE)"; exit 1; } +[ "$(ip netns list 2>/dev/null | grep -c "^warp-${NODE}")" -ge 1 ] || { echo "node '$NODE' is not up (netvm-node-up.sh $NODE)"; exit 1; } exec sudo -n "$NETVM_BIN/netvm-enter.sh" "$NODE" "$(id -u)" "$(id -g)" "$HOME" -- "$@"