How to create a Java stack trace

Sometimes the Support engineers at Wowza Media Systems™ need you to provide a Java stack trace file for troubleshooting purposes. This article describes the various methods available for getting a "trace" of the Java stack on your Wowza media server.

Contents


Create a stack trace using the Wowza Streaming Engine REST API
Create a stack trace using VisualVM
Create a stack trace using jstack
More resources

Create a stack trace using the Wowza Streaming Engine REST API


Note: Wowza Streaming Engine™ software version 4.5.0.01 or later is required to use this method.
To take a stack trace, use the following request:
curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://127.0.0.1:8087/v2/servers/{serverName}/actions/stackTrace
This will write the stack trace to [install-dir]/WowzaStreamingEngine_StackTrace_${epoch}.stack. The ${epoch} variable is replaced with the current system epoch in milliseconds.

You can change where the stack trace is written to by including the filename query parameter in the request. The filename is a FULL path for the output file. For example, to write the stack trace to C:\Temp, you would use the following request:
curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://127.0.0.1:8087/v2/servers/{serverName}/actions/stackTrace?filename="C:\Temp\WowzaStreamingEngine_StackTrace_${epoch}.stack"

Create a stack trace using VisualVM


Note: Wowza Streaming Engine™ software or Wowza Media Server™ software is required to use this method. If you're running Wowza Streaming Engine software version 4.5.0.01 (or later), we recommend the easier REST API method.
  1. Configure the JMX interface to the Wowza media server using the instructions in the article, How to use JConsole with Wowza media server software.
     
  2. Install VisualVM.
     
  3. Connect to the Wowza media server using VisualVM through JMX:
     
    1. On the File menu, select Add JMX Connection.
       
    2. In Connection, enter the Wowza media server URL.
       
    3. Select the Enter Security Credential option, and then enter the Username and Password required to access the media server.
  4. On the Threads tab, click the Thread Dump button.
     
  5. Copy and paste the thread dump information into a text file.

Create a stack trace using jstack


Note: Your Wowza media server must be running the Java JDK to use this method. The Java JDK includes the jstack tool for printing Java thread stack traces.
  1. Open a command prompt and "change directory" to the bin folder of the JDK installation.
     
  2. Use operating system tools such as ps (ps -ef on Linux or the Task Manager on Windows) to find the process ID of the Java process that's running the Wowza server software.
     
  3. Execute the following command:
    jstack [pid] > thread.dump
    Where [pid] is the process ID of the process running the Wowza server software.

More resources


How to create a Java heap dump
Originally Published: 04-04-2010.
Updated: For Wowza Streaming Engine 4.5.0.01 on 08-18-2016.
 

If you're having problems or want to discuss this article, post in our forum.