Create a Java heap dump 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 heap dump file. This article describes how to get a dump of the Java heap on Wowza Streaming Engine.

Create a Java heap dump using the Wowza Streaming Engine REST API

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

To create a heap dump, use the following request:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8'{serverName}/actions/heapDump

This writes the heap dump to [install-dir]/WowzaStreamingEngine_HeapDump_${epoch}.hprof. The ${epoch} variable is replaced with the current system epoch in milliseconds.

You can change the location of the heap dump by including the filename query parameter in the request. For example, to write the heap dump to C:\Temp, use the following request:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8'{serverName}/actions/heapDump?filename="C:\Temp\WowzaStreamingEngine_HeapDump_${epoch}.hprof"

Create a Java heap dump using JConsole

Use this method for Wowza Streaming Engine 4.4.1 and earlier.

  1. Use JConsole/JMX to connect to the running Wowza Streaming Engine.
  2. On the MBeans tab, in the object, select the Operation section.
  3. In dumpHeap parameters, enter the following information:
    p0: [heap-output-path]
    p1: true - do a garbage collection before dump heap

    For example:

    p0: c:/dump.dmp
    p1: true
  4. Click the dumpHeap button.

Create a Java heap dump using jHat

To use this method, Wowza Streaming Engine must be running the Java JDK, which includes the Java Heap Analysis Tool (jHat) tool.

  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:
    jmap -dump:format=b,file=c:\Temp\mymemorydump.hprof [pid]

    Where [pid] is the process ID of the process running Wowza Streaming Engine.

Create a Java heap dump automatically when an OutOfMemory error is thrown 

You can configure Java to create a heap dump whenever an "OutOfMemory" error occurs.

Open the [install-dir]/conf/Tune.xml file in a text editor, and then uncomment the following line:

For Linux and macOS:

<VMOption>-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${com.wowza.wms.AppHome}/logs</VMOption>

For Windows:

<VMOption>-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="${com.wowza.wms.AppHome}/logs"</VMOption>

Save the file and then restart Wowza Streaming Engine.

Note: To force a garbage collection cycle before creating a heap dump, run the command jcmd [pid]

More resources