Skip to content

Instantly share code, notes, and snippets.

@jclulow
Created February 13, 2017 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jclulow/2ca9d0c6f5fedd99518ffa92be6f28ba to your computer and use it in GitHub Desktop.
Save jclulow/2ca9d0c6f5fedd99518ffa92be6f28ba to your computer and use it in GitHub Desktop.
#!/bin/bash
set -o errexit
set -o pipefail
stamp=$(date +%s)
mkdir "/var/tmp/inspect_moray.$stamp"
cd "/var/tmp/inspect_moray.$stamp"
pidlist=$(svcs -p moray | awk '$NF == "node" { print($(NF - 1 )) }')
for p in $pidlist; do
echo "pid: $p"
if ! gcore $p; then
echo "gcore failed, skipping $p"
continue
fi
if ! res=$(mdb -e '::load v8; ::findjsobjects -c ConnectionManager | ::findjsobjects | ::jsprint state socket.destroyed socket._connecting socket._bytesDispatched socket.bytesRead connectTimeoutHandler.ontimeout' core.$p 2>&1); then
echo "mdb failed, skipping $p"
echo "mdb output: $res"
rm -f core.$p
continue
fi
rm -f core.$p
grep '^1 false false 48 0 null$' <<< "$res" || true
echo
done
cd /
rmdir "/var/tmp/inspect_moray.$stamp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment