| Determine if the”default” ExecuteThread queue is overloaded. Use the console to determine if any of the ExecuteThreads in the ‘default’ queue are idle. If none are idle, then the application probably needs to be configured with a larger number of ExecuteThreads. This value can be changed through the console and is in the config.xml file.
If the Execute Queue has idle threads, it is possible that not enough socket reader threads are allocated. By default, a WebLogic Server instance creates three socket reader threads upon booting. If a cluster system utilizes more than three sockets during peak periods, increase the number of socket reader threads.
The number of socket reader threads should usually be small. However, configure one thread for each Weblogic Server that acts as a client of the server instance that is hanging.
If using a JDBC connection pool, ensure that the JDBC connections have been configured to be equivalent to the number of simultaneous requests, i.e., execute threads, for the pool.
Top of Page
The possibility exists that a problem with JDBC could produce deadlock. Check the version and service pack level of the server found in the beginning of the weblogic.log. Then check above the version and service pack lines for any temporary patches that have already been applied to the server classpath. The patches will tell what problems have already been addressed.
Top of Page
The way to take a thread dump is dependent on the operating system where the hung server instance is installed. Information about taking a thread dump on various operating systems can be found at http://e-docs.bea.com/wls/docs81/cluster/trouble.html#gc. Redirection of both standard error and standard out places the thread dump information in the proper context with server information and other messages and provides more useful logs.
Unix Systems (Solaris, HP, AIX)
Use kill –3 <weblogic process id> to create the necessary thread dumps to diagnose a problem. Ensure this is done several times on each server, spaced about 5 to 10 seconds apart, to help diagnose deadlocks. For this to work, nohup the process when starting the server (refer to Solutions S-12292 and S-15924).
Windows, XP, NT
Each server requires <Ctrl>-<Break> to create the necessary thread dumps to diagnose a problem. Ensure this is done several times on each server, spaced about 5 to 10 seconds apart, to help diagnose deadlocks. On NT, in the command shell type CTRL-Break.
If you have installed WebLogic as a Windows service, you will not be able to see the messages from the JVM or WebLogic Server that are printed to standard out or standard error. To view these messages, you must direct standard out and standard error to a file. To do this, take the following steps:
- Create a backup copy of the WL_HOME\server\bin\installSvc.cmd master script.
- In a text editor, open the WL_HOME\server\bin\installSvc.cmd master script.
- In installSvc.cmd, the last command in the script invokes the beasvc utility.
- At the end of the beasvc command, append the command -log:”pathname”
where pathname is a fully qualified path and filename of the file that you want to store the server’s standard out and standard error messages.
- The modified beasvc command will resemble the following command:
“%WL_HOME%\server\bin\beasvc” -install
-svcname:”%DOMAIN_NAME%_%SERVER_NAME%”
-javahome:”%JAVA_HOME%” -execdir:”%USERDOMAIN_HOME%”
-extrapath:”%WL_HOME%\server\bin” -password:”%WLS_PW%”
-cmdline:%CMDLINE%
-log:”d:\bea\user_projects\domains\myWLSdomain\myWLSserver-stdout.txt”
- If you started WebLogic with nohup, the log messages will show up in nohup.out.
Linux
The Linux operating system views threads differently than other operating systems. Each thread is seen by the operating system as a process. To take a thread dump on Linux, find the process id from which all the other processes were started. Use the commands:
- To obtain the root PID, use:
ps -efHl | grep ‘java’ **. **
Use a grep argument that is a string that will be found in the process stack that matches the server startup command. The first PID reported will be the root process, assuming that the ps command has not been piped to another routine.
- Use the weblogic.Admin command THREAD_DUMP
Another method of getting a thread dump is to use the THREAD_DUMP admin command. This method is independent of the OS on which the server instance is running.
java weblogic.Admin -url ManagedHost:8001 -username weblogic -password weblogic THREAD_DUMP
NOTE: This command cannot be used if unable to ping the server instance.
If the JVM in use is Sun’s, the thread dump goes to stdout. Sun has enhanced the thread dump format between JVM 1.3.1 and 1.4. To obtain Sun’s 1.4 style of thread dump add the following option to the java command line for starting the 1.3.1 JVM:
-XX:+JavaMonitorsInStackTrace
Top of Page
The most useful tool in analyzing a server hang is a set of thread dumps. A thread dump provides information on what each of the threads is doing at a particular moment in time. A set of thread dumps (usually 3 or more taken 5 to 10 seconds apart) can help analyze the change or lack of change in each thread’s state from one thread dump to another. A hung server thread dump would typically show little change in thread states from the first to the last dump.
Threads can be in one of the following states:
| Running or runnable thread |
A runnable state means that the threads could be running or are running at that instance in time. |
| Suspended thread |
Thread has been suspended by the JVM. |
| Thread waiting on a condition variable |
Threads in a condition wait state can be thought of as waiting for an event to occur. |
| Thread waiting on a monitor lock |
Monitors are used to manage access to code that should only be run by a single thread at a time |
More information on thread states can be found at http://java.sun.com/developer/onlineTraining/Programming/JDCBook/stack.html#states.
There is also a thread analysis tool at http://dev2dev.bea.com/resourcelibrary/utilitiestools/adminmgmt.jsp.
Download the tool and read the instructions at the link.
What to Look at in the Thread Dump
All requests enter the WebLogic Server through the ListenThread. If the ListenThread is gone, no work can be received and therefore no work can be done. Verify that a ListenThread exists in the thread dump. The ListenThread should be in the socketAccept method. The following example shows what the Listen Thread looks like: |
最及时的声音