← back to Exo Keepalive
run-exo.sh: reap orphaned exo venv python holding :52414/:52415 before exec — uv spawns python so kickstart -k orphaned it and every respawn hit 'Address already in use' (TK-11874)
39c613087b58736bf2dfa2631f429f84ef171405 · 2026-09-16 18:57:45 -0700 · Steve Abrams
Files touched
Diff
commit 39c613087b58736bf2dfa2631f429f84ef171405
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Sep 16 18:57:45 2026 -0700
run-exo.sh: reap orphaned exo venv python holding :52414/:52415 before exec — uv spawns python so kickstart -k orphaned it and every respawn hit 'Address already in use' (TK-11874)
---
run-exo.sh | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/run-exo.sh b/run-exo.sh
index 6f2f94e..d4a5d68 100755
--- a/run-exo.sh
+++ b/run-exo.sh
@@ -8,5 +8,21 @@ export PATH="/Users/macstudio3/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/
cd "$HOME/exo" || exit 1
LOG="$HOME/Projects/exo-keepalive/exo.log"
echo "[$(date +%FT%T%z)] === exo start (pid $$) ===" >> "$LOG"
+# TK-11874: reap any ORPHANED exo python still holding our ports before we start.
+# `uv run` SPAWNS python (it does not exec), so when launchd kills the tracked uv
+# (watchdog `kickstart -k`, SIGKILL) the python child survives as a PPID-1 orphan
+# holding :52414 (zenoh) and every respawn dies with "Address already in use" —
+# three multi-hour outages 09-12..09-16. Scoped to exo's OWN venv python only, so
+# this can never touch any other process. Anything holding these ports when this
+# script starts is by definition not the process launchd is about to track.
+for p in $(lsof -tnP -iTCP:52414 -iTCP:52415 -sTCP:LISTEN 2>/dev/null); do
+ if ps -o command= -p "$p" 2>/dev/null | grep -qF "$HOME/exo/.venv/bin/python"; then
+ echo "[$(date +%FT%T%z)] reaping orphan exo python pid $p holding :52414/:52415" >> "$LOG"
+ kill "$p" 2>/dev/null
+ for _ in 1 2 3 4 5 6 7 8 9 10; do kill -0 "$p" 2>/dev/null || break; sleep 1; done
+ kill -0 "$p" 2>/dev/null && kill -9 "$p" 2>/dev/null
+ fi
+done
+sleep 1
# exec so launchd tracks the real exo process (respawns on crash)
exec /Users/macstudio3/.local/bin/uv run --extra mlx exo >> "$LOG" 2>&1
← 5cd19e9 chore(git-bloat): gitignore exo.log so it can't be re-tracke
·
back to Exo Keepalive
·
(newest)