idle cpu fix test (#6015)

This commit is contained in:
Anthony Stirling
2026-04-01 11:58:10 +01:00
committed by GitHub
parent cfa8d1e5d7
commit 0a098cf7b7
3 changed files with 28 additions and 7 deletions

View File

@@ -287,10 +287,20 @@ start_unoserver_watchdog() {
if [ "$needs_restart" = true ]; then
log "Restarting unoserver on 127.0.0.1:${port} (uno-port ${uno_port})"
# Kill the old process if it exists
# Kill the old process and its children (soffice) if it exists.
# Capture child PIDs first, then send TERM to children before parent
# so the PPID relationship is still visible. After sleep, use the
# saved PIDs for SIGKILL since the parent may have already exited
# and children would be reparented to init.
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
local child_pids
child_pids=$(pgrep -P "$pid" 2>/dev/null || true)
pkill -TERM -P "$pid" 2>/dev/null || true
kill -TERM "$pid" 2>/dev/null || true
sleep 1
sleep 3
if [ -n "$child_pids" ]; then
kill -KILL $child_pids 2>/dev/null || true
fi
kill -KILL "$pid" 2>/dev/null || true
fi
start_unoserver_instance "$port" "$uno_port"