diff --git a/openfut-blaze-host/sidecar.sh b/openfut-blaze-host/sidecar.sh index 1c47e96..bdfbf03 100755 --- a/openfut-blaze-host/sidecar.sh +++ b/openfut-blaze-host/sidecar.sh @@ -79,7 +79,14 @@ list_sidecars() { for d in /proc/[0-9]*; do pid="${d#/proc/}" [[ "$pid" == "$self" ]] && continue - exe="$(readlink -f "$d/exe" 2>/dev/null)" || continue + # readlink, NOT readlink -f: once the binary is rebuilt the link reads + # " (deleted)", and -f resolves that to something that matches + # nothing. The orphan check would then be blind to exactly the long-lived + # processes it exists to find — verified: two orphans (a stale-cert + # redirector and a Blaze sidecar) were both invisible to this until the + # suffix was stripped. + exe="$(readlink "$d/exe" 2>/dev/null)" || continue + exe="${exe% (deleted)}" [[ "${exe##*/}" == "openfut-blaze-host" ]] && echo "$pid" done return 0 diff --git a/openfut-redirector-host/redirector.sh b/openfut-redirector-host/redirector.sh index ee13ddd..3741b80 100755 --- a/openfut-redirector-host/redirector.sh +++ b/openfut-redirector-host/redirector.sh @@ -35,7 +35,14 @@ list_procs() { local self=$$ pid exe for d in /proc/[0-9]*; do pid="${d#/proc/}"; [[ "$pid" == "$self" ]] && continue - exe="$(readlink -f "$d/exe" 2>/dev/null)" || continue + # readlink, NOT readlink -f: once the binary is rebuilt the link reads + # " (deleted)", and -f resolves that to something that matches + # nothing. The orphan check would then be blind to exactly the long-lived + # processes it exists to find — verified: two orphans (a stale-cert + # redirector and a Blaze sidecar) were both invisible to this until the + # suffix was stripped. + exe="$(readlink "$d/exe" 2>/dev/null)" || continue + exe="${exe% (deleted)}" [[ "${exe##*/}" == "openfut-redirector-host" ]] && echo "$pid" done return 0