#!/bin/bash
CURRENTUSER=`whoami`
echo "pid user stuck"
ps -ef | grep java | grep -v grep | while read LINE
do
SOAUSER=$(echo $LINE | awk '{print $1}')
if [ $SOAUSER == $CURRENTUSER ]
then
PID=$(echo $LINE | awk '{print $2}')
NAME=$(echo $LINE | sed -n -e 's/.*-Dweblogic.Name=\([^ ]*\).*/\1/p')
if [ -z "$NAME" ] ; then
NAME=$(echo $LINE | sed -n -e 's/.*weblogic.\(NodeManager\).*/\1/p')
fi
if [ -z "$NAME" ] ; then
NAME="UnknownApp"
fi
STUCKCOUNT=`jstack $PID | grep "STUCK" | wc -l`
echo "PID=" $PID "NAME=" $NAME "STUCKCOUNT" $STUCKCOUNT
fi
done
Showing posts with label stuckthread. Show all posts
Showing posts with label stuckthread. Show all posts
Saturday, June 29, 2013
Count stuck threads in WebLogic
nice little script to count the stuck threads in all instances of WebLogic (or any other Java processes) running under the current user:
Labels:
stuckthread
Friday, May 31, 2013
Nice little JSP to generate threads on demand
<%
final String threads = request.getParameter("threads");
final String period = request.getParameter("period");
try {
for (int t = 0; t < Integer.parseInt(threads); t++ ) {
System.out.println("starting thread " + t + " of " + threads);
Thread thread = new Thread(new Runnable() {
public void run() {
try {
System.out.println("started with period " + period);
Thread.sleep(Integer.parseInt(period) * 1000);
}
catch (Throwable t) {
t.printStackTrace();
}
}
});
thread.start();
};
}
catch (Throwable t) {
t.printStackTrace();
}
%>
and you invoke it as
http://acme.com:10001/wlstuck/index.jsp?threads=30&period=40
and you redeploy with
import os
theapplication=str(sys.argv[1])
print "redeploying", theapplication
os.system("rm -rf /opt/oracle/domains/osbts1do/servers/osbts1as/tmp/_WL_user/" + theapplication + "/")
connect('Pierluigi', 'weblogic1', 't3://acme.com:9001')
redeploy(theapplication)
exit()
problem is that these threads will not be part of the WebLogic thread pool, and as such they will not be monitored.
A better option is a shell script:
for i in {1..30}
do
wget http://acme.com:10001//wlstuck &
done
and the index.jst is simply:
Thread.sleep(390 * 1000);
Labels:
jsp,
stuckthread
Subscribe to:
Posts (Atom)