From 44abdc05033083000309bf14b045b134c0e40e60 Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Fri, 24 Nov 2023 15:17:45 +0200 Subject: [PATCH] Run mariabackup SST timeout command on foreground Without `--foreground` option timeout command forks and detaches from mariadbackup SST script process group. If the script fails, the process remains running on background until either socat exits or the timeout expires. Potential fix and extra diagnostics for troubleshooting. --- scripts/wsrep_sst_mariabackup.sh | 4 ++-- scripts/wsrep_sst_rsync.sh | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 93f9270e7900d..35ac01739804f 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -809,9 +809,9 @@ recv_joiner() fi fi if [ $koption -ne 0 ]; then - ltcmd="timeout -k $(( tmt+10 )) $tmt $tcmd" + ltcmd="timeout --foreground -k $(( tmt+10 )) $tmt $tcmd" else - ltcmd="timeout -s 9 $tmt $tcmd" + ltcmd="timeout --foreground -s 9 $tmt $tcmd" fi fi fi diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 3e63596bcbef3..352a18a642f8e 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -142,6 +142,8 @@ check_pid_and_port() if ! check_port $pid "$port" "$utils"; then wsrep_log_error "rsync or stunnel daemon port '$port'" \ "has been taken by another program" + ps --forest 1>&2 + netstat -natp | grep "$port" 1>&2 exit 16 # EBUSY fi fi @@ -551,6 +553,7 @@ EOF WHOLE_FILE_OPT='--whole-file' fi + ps --forest 1>&2 # Old filter - include everything except selected # FILTER=(--exclude '*.err' --exclude '*.pid' --exclude '*.sock' \ # --exclude '*.conf' --exclude core --exclude 'galera.*' \ @@ -877,6 +880,8 @@ EOF sleep 0.2 done + ps --forest 1>&2 + echo "ready $ADDR:$RSYNC_PORT/$MODULE" MYSQLD_PID="$WSREP_SST_OPT_PARENT"