Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Get thread dump and heap dump for MID Server - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Get thread dump and heap dump for MID Server
KB0656229

Get thread dump and heap dump for MID Server


9849 Views Last updated : Feb 23, 2024 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Issue

On rare occasions when a MID Server cannot or is slow to pick up messages from the instance, you would like to get a thread dump to troubleshoot. This article describes how to do so. Note that you need to have login access to the MID Server.

How to get thread dump and heap dump

  1. Modern MID Servers include jstack and jmap in their JRE bundle, check the agent\jre\bin folder first for the presence of jstack and jmap, if it is missing, download a JDK compatible with the MID Server JRE to get the jstack.exe executable from the JDK.

    You might run into some unsupported JVM version exceptions if you install the wrong JDK version. Older versions/patches of Oracle JDK are available here. e.g. 8u60 or 8u152.

    If the default JDK/JRE does not have jmap installed, here is a known JDK with jmap bundled:
    https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_windows-x64_bin.zip

    *** NOTE: If downloading the above JDK, you do not need to make any configuration changes on the MID server (e.g: changing the MID server run time environment). For the commands below you would just execute the commands from the downloaded JDK path.
  2. (If gathering thread dump) Download and unzip PSTools: https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx. You might not have to do this but PsExec is needed to invoke jstack.exe on a process that is run as Local System, this used to be the default but now MID Servers are often running as a non-admin service account when the MID Server is run as a Windows service.

  3. Open Task Manager. In 'Processes' tab, sort by Image Name then find 'java.exe' processes. Note the process ID under 'PID' column. If 'PID' column is not shown, goto View > Select Column... and select 'PID' column.

  4. if multiple MID Servers are running, right click each 'java.exe' process then select Properties, to verify correct MID Server process.

     

  5. (If gathering thread dump) Open Command Prompt as Administrator change to directory where PSTools is unzipped in step 2. Run the following command if MID Server service account is 'SYSTEM':

    psexec -s "<path_to_jdk_install>\bin\jstack" -l PID_HERE >> <path_for_generated_file>\threadDump.txt

    if MID Server service account is a user:

    psexec -u <username> "<path_to_jdk_install>\bin\jstack" -l PID_HERE >> <path_for_generated_file>\threadDump.txt

  6. (If gathering heap dump) Run this command:

    <path_to_jdk_install>\bin\jmap -dump:file=<path_for_generated_file>\heapDump.bin PID_HERE

  7. Alternately, to dump the heap automatically on out-of-memory exception, modify the wrapper-override.conf file found in the /agent/conf/ directory by adding the following:

        "wrapper.app.additional.501=-XX:+HeapDumpOnOutOfMemoryError" OR "wrapper.java.additional.501=-XX:+HeapDumpOnOutOfMemoryError". 

             ***WARNING: This parameter should only be used for short term with active monitoring. As soon as OOM is reproduced and Heapdump is generated, the parameter must be removed. Leaving this parameter in place for extended period can potentially exhaust disk space.

             There should be no duplicates in either /agent/conf/wrapper.conf or /agent/conf/wrapper-override.conf files.       

             Here is an example:

             

References

jmap - Memory Map – How to use jmap

jstack - Stack Trace – How to use jstack

Release

All currently supported releases.

Related Links

KB0717248 How to automatically generate the heap dump from Mid when JVM runs out of memory

KB0746066 How to analyse a MID Server Heap Dump, for High Memory usage


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.