Create a Java stack trace for Wowza Streaming Engine

When you open a Support ticket for Wowza Streaming Engine™ media server software, the Support engineers at Wowza Media Systems™ may ask you to provide a Java stack trace file. This article describes how to get a "trace" of the Java stack on Wowza Streaming Engine.

Install Java JRE or JDK


To use this method, Wowza Streaming Engine must be running the full Java JRE or JDK, which includes the jcmd tool. By default, Wowza Streaming Engine installs with a custom version of the Java JRE. In order to run the jcmd command, you must first complete these steps.

Notes: Starting with Wowza Streaming Engine 4.8.28, we're including the jdk.jcmd Java module with the JRE that ships with the installer. This eliminates the need to complete the steps in this section. For more, see Wowza Streaming Engine support for Java.
  1. Download and install the full version of the Java JRE or JDK.
  2. Set your installation of Wowza Streaming Engine to point to the full Java JRE or JDK you just installed. See Manually install and troubleshoot Java on Wowza Streaming Engine.

Create a stack trace using jcmd


Note: The commands in this section must be run by the same user that owns the Java process that's running Wowza Streaming Engine.
  1. Open a command prompt and run the following command to find the process ID of the Java process that's running Wowza Streaming Engine (com.wowza.wms.bootstrap.Bootstrap):
    jcmd

  2. Then, execute the following command:
     
    jcmd [pid] Thread.print > [install-dir]/logs/stacktrace.txt

    Where [pid] is the process ID of the process running Wowza Streaming Engine, and [install-diris the path of the Wowza Streaming Engine installation.

Create a stack trace using the Wowza Streaming Engine REST API


This method can be used with Wowza Streaming Engine 4.5.01 and later.

Notes: 
  • To get started with the Wowza Streaming Engine REST API, see articles in the Overview section.
  • If the server is not responding, these instructions may not work. We recommend using the jcmd method to create the stack trace instead.

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 writes 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 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


Use this method for Wowza Streaming Engine 4.4.1 and earlier.

  1. Configure the JMX interface to the Wowza Streaming Engine according to the instructions Use JConsole with Wowza Streaming Engine.
  2. Install VisualVM.
     
  3. Connect to Wowza Streaming Engine 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


To use this method, Wowza Streaming Engine must be running the Java JDK, which 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 Wowza Streaming Engine.
     
  3. Execute the following command:
     
    jstack [pid] > thread.dump
    Where [pid] is the process ID of the process running Wowza Streaming Engine.

More resources