Skip to content

Commit 35480f9

Browse files
khaliqgantclaude
andcommitted
fix: relay down kills orphaned processes by port
Subshell PIDs in .relay/pids may not match the actual service process. Now also kills any process on :8787 and :8080 to handle orphans. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 54c63e3 commit 35480f9

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

scripts/relay/relay.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,11 +611,15 @@ cmd_down() {
611611
stop_pid "${RELAYAUTH_PID:-}" "relayauth"
612612
stop_pid "${RELAYFILE_PID:-}" "relayfile"
613613
rm -f ".relay/pids"
614-
echo "Stopped relay services"
615-
return 0
616614
fi
617615

618-
echo "No relay service PID file found"
616+
# Also kill any processes on our ports (handles orphaned processes
617+
# from subshells that exited while the service kept running)
618+
local port_pid
619+
port_pid="$(lsof -ti:8787 2>/dev/null)" && kill -9 "${port_pid}" 2>/dev/null && echo " killed orphan on :8787"
620+
port_pid="$(lsof -ti:8080 2>/dev/null)" && kill -9 "${port_pid}" 2>/dev/null && echo " killed orphan on :8080"
621+
622+
echo "Stopped relay services"
619623
}
620624

621625
cmd_provision() {

0 commit comments

Comments
 (0)