Skip to Content

How to setup Jstack tracing for SUP 2.x

How to setup Jstack tracing for SUP 2.x


This technical document explains how to setup Jstack and perform a stack trace.


jstack prints Java stack traces of Java threads for a given Java process or core file or a remote
debug server. For each Java frame, the full class name, method name, 'bci' (byte code index)
and line number, if available, are printed. With the -m option, jstack prints both Java and native
frames of all threads along with the 'pc' (program counter). For each native frame, the closest
|native symbol to 'pc', if available. Jstack is part of the JDK that is installed under Sybase.

Required Software

1.            SUP 2.x.x or higher.
2.            PSTools from Microsoft.
3.            Access to Sybase Control Center.
4.            Access to the JDK under the Sybase.


  • This document assumes you have a working SUP environment.
  • You have downloaded the PSToolsfrom Microsoft.
  • Have Administrator rights to the Operating System and Sybase Unwired Server.

Issue 1 High CPU utilization locking in the CDB.

  • User needs to debug high CPU usage.
  • User needs to investigate locks in the CDB.
  • User needs to investigate hanging SPID


In order do that you need to configure JStack.
2. Extract PsTools to say, C:\PsTools
3. You will need to get the PID of the mlsrver exe from task manager.
Figure 1
  1. Look for mlsrv12.exe process and its PID.
  2. To make it easy to run the jstack create a simple batch file.
A-   Create an empty text file and name it jStack.bat.
B-   Add the following lines
set MLSRV_PID=2345
C:\Sybase\UnwiredPlatform\JDK1.6.0_31-x64\bin\jinfo -sysprops
%MLSVR_PID%  >jstack_mlsvr12.txt
C:\PSTools\psexec -s C:\Sybase\UnwiredPlatform\JDK1.6.0_31-x64\bin\jstack
-F %MLSRV_PID%  >> jstack_mlsvr12.txt
C-   Save the file.
D-   Copy the batch file to location that has write permission in the directory.
  1. Make sure you change the PID= with your SPID for mlsrv12.exe.
We are now done with the setup of the jstack. Next we will need to configure the
debug options in Sybase Control Center in Step 2.

Step 2 Configure Sybase Control Center for debugging:

User needs to enable debug options in Sybase Control Center.


In order to do that, you need to have access to the SCC as an Administrator.
1.    Open SCC via the desktop IE icon.
2.    Navigate to Servers.
3.    Tree Open the Primary server.
4.    High light *LOG.
5.    Go to the TAB Unwired server.
6.    Go to Settings.*.
7.    Change Mobilink to DEBUG.
8.    Change MMS to DEBUG.
9.    Change DataServices to DEBUG.
10.  Click the Save button.
Figure 2
11.  Next we will need to add the Mobilink trace flag –v+ ru.
12.  Go to Server Configuration.
13.  Go to the *Replication TAB.
14.  At the bottom tree open the hide optional properties.
15.  On the line for User Options add the follow values –v+ru
16.  Click on the save button.
    Figure 3
17.  You will have to restart the Sybase Unwired Server.
This completes the setup of the debug option in Sybase Control Center.
We are now ready to perform the stack trace in Step 3.

Step 3 Running the jStack and gathering a stack trace:

  • Capturing the thread processes.


Run the jstack batch file that we created.

1.    Open a command Prompt with Admin rights.
2.    CD to the location where you have the jstack.bat file.
3.    From the command line execute C:>jstack.bat.
Figure 4
4.   Once the trace is completed or windows explorer and go to the
directory where you ran the jstack,batfile you should see the output file
5.   You need run the jstack.bat file in one minuetintervals for three or four time.
6.   You will need to open the jstack_mlsrv12.txt with a text editor like Note++
7.   The output will be similar to this 
Figure 5
Look any locks that are on the database. This will help support narrow down the cause
of the lock or hangs and if it is normal or abnormal condition.
This document explained in details about the steps needed to set up the Jstacktool and
capture the processing threads in the Sybase Unwired Server to show if there is any issues
such as locks on the database. In addition the jstacktrack can also show who is active and
how much work the process is doing. This is a very valuable tool to track down hanging
threads and what they are doing.