scripts: Run scriptstatus for hung event
authorMartin Schwenke <martin@meltin.net>
Mon, 22 Jul 2013 05:08:32 +0000 (15:08 +1000)
committerMartin Schwenke <martin@meltin.net>
Mon, 29 Jul 2013 04:02:13 +0000 (14:02 +1000)
The timeout information printed by ctdbd is less than useful because
it refers to the cumulative time taken by the eventscripts run so far.
Adding scriptstatus output indicates where time was actually spent.

Since there is now quite a bit of output, serialise the calls to this
script using flock.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

config/debug-hung-script.sh [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index dcf68ba..32dbd5f
@@ -1,4 +1,19 @@
 #!/bin/sh
 
-echo "Pstree output for the hung script:"
-pstree -p -a $1
+(
+    flock --wait 2 9 || exit 1
+
+    echo "===== Start of hung script debug for PID=\"$1\", event\"$2\" ====="
+
+    echo "pstree -p -a ${1}:"
+    pstree -p -a $1
+
+    echo "ctdb scriptstatus ${2}:"
+    # No use running several of these in parallel if, say, "releaseip"
+    # event hangs for multiple IPs.  In that case the output would be
+    # interleaved in the log and would just be confusing.
+    ctdb scriptstatus "$2"
+
+    echo "===== End of hung script debug for PID=\"$1\", event\"$2\" ====="
+
+) 9>"${CTDB_VARDIR}/debug-hung-script.lock"