Skip to content

Commit f0ffb63

Browse files
committed
fix(installer): treat zombie Relay processes as stopped
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
1 parent 247aee0 commit f0ffb63

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

scripts/test-uninstall.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ test_force_confirmation_controls_shutdown() {
218218
run_interactive_uninstaller y "$install_dir"
219219
assert_success
220220
[ ! -e "$relay_binary" ] || fail 'accepted confirmation did not remove the Relay binary'
221+
wait "$session_pid" 2>/dev/null || true
221222
if kill -0 "$session_pid" 2>/dev/null; then
222223
fail 'accepted confirmation did not terminate the Relay process'
223224
fi
224-
wait "$session_pid" 2>/dev/null || true
225225
active_session_pid=""
226226
return 0
227227
}
@@ -274,11 +274,11 @@ EOF
274274
run_interactive_uninstaller y "$install_dir"
275275
assert_success
276276
[ ! -e "$relay_binary" ] || fail 'accepted coding-agent confirmation did not remove the Relay binary'
277+
wait "$agent_pid" 2>/dev/null || true
277278
kill -0 "$agent_pid" 2>/dev/null && fail 'accepted confirmation did not terminate the coding agent owner'
278279
for child_pid in $active_child_pids; do
279280
kill -0 "$child_pid" 2>/dev/null && fail "accepted confirmation did not terminate MCP child ${child_pid}"
280281
done
281-
wait "$agent_pid" 2>/dev/null || true
282282
active_session_pid=""
283283
active_child_pids=""
284284
return 0

uninstall.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ terminate_process_tree() {
205205
wait_for_process_exit() {
206206
wait_pid=$1
207207
wait_attempt=0
208-
while kill -0 "$wait_pid" 2>/dev/null; do
208+
while process_is_running "$wait_pid"; do
209209
if [ "$wait_attempt" -ge 5 ]; then
210210
error "process ${wait_pid} did not stop after termination was confirmed"
211211
fi
@@ -214,6 +214,14 @@ wait_for_process_exit() {
214214
done
215215
}
216216

217+
process_is_running() {
218+
process_state=$(ps -p "$1" -o stat= 2>/dev/null | sed -n '1p' | awk '{$1 = $1; print}')
219+
case "$process_state" in
220+
""|Z*) return 1 ;;
221+
esac
222+
kill -0 "$1" 2>/dev/null
223+
}
224+
217225
stop_active_relay_processes() {
218226
active_targets=$(active_shutdown_target_pids)
219227
[ -n "$active_targets" ] || return 0

0 commit comments

Comments
 (0)