Web lists-archives.com

Re: [Samba] CTDB problems




On Wed, 19 Apr 2017 18:06:35 +0200, David Disseldorp via samba wrote:

> > 2017/04/19 10:40:31.294250 [ 7423]: /etc/ctdb/debug_locks.sh: line 73: 
> > gstack: command not found  
> 
> This script attempts to dump the stack trace of the blocked process,
> but can't as gstack isn't installed - it should be available in the
> gdb package.
> 
> @Martin: would the attached (untested) patch make sense?

Gah, this time with the actual patch, instead of a Vim swap file.

Cheers, David
>From 17c81342d87e64baceb32ca6b321533cfb623526 Mon Sep 17 00:00:00 2001
From: David Disseldorp <ddiss@xxxxxxxxx>
Date: Wed, 19 Apr 2017 17:46:40 +0200
Subject: [PATCH] ctdb/debug_locks.sh: only run gstack if installed

debug_locks.sh walks the list of waiting processes and attempts to dump
the stack trace for each. gstack should only be called if installed.

Signed-off-by: David Disseldorp <ddiss@xxxxxxxxx>
---
 ctdb/config/debug_locks.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ctdb/config/debug_locks.sh b/ctdb/config/debug_locks.sh
index f678724c434..5accec22491 100755
--- a/ctdb/config/debug_locks.sh
+++ b/ctdb/config/debug_locks.sh
@@ -16,6 +16,7 @@
 # These can be overwritten from CTDB configuration
 CTDB_DBDIR="${CTDB_VARDIR}"
 CTDB_DBDIR_PERSISTENT="${CTDB_VARDIR}/persistent"
+GSTACK_BIN="$(which gstack 2>/dev/null)"
 
 loadconfig ctdb
 
@@ -74,9 +75,12 @@ loadconfig ctdb
 		# blame!
 		echo "----- Process in D state, printing kernel stack only"
 		cat "/proc/${pid}/stack"
-	    else
-		gstack "$pid"
+	    elif [ -x "$GSTACK_BIN" ] ; then
+		$GSTACK_BIN "$pid"
 		# gcore -o /var/log/core-deadlock-ctdb $pid
+	    else
+		echo "----- gstack missing, printing kernel stack only"
+		cat "/proc/${pid}/stack"
 	    fi
 	done
     fi
-- 
2.12.0

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba