Thread dumps can help to identify IDE performance problems when it locks and user interface doesn't respond.
A dump should be taken exactly at the moment when IDE doesn't respond and will record the thread stack. Recording several thread dumps with 1-2 seconds interval can be also very useful for the problem analysis.
This command line utility is provided with the JDK installation and can be found in JAVA_HOME\bin directory or the <ide_installed_path>/jbr/bin (available on the IDE 2021.1 and later version). Make sure to use the same or close JDK version to the one the IDE runs under (see Help | About). It will not work if IDE runs under 32-bit JDK and you run jstack from the 64-bit JDK distribution and vice versa.
To use jstack you need the IDE process identifier (PID). PID can be obtained using jps utility that is located in the same directory as jstack.
This command will list the Java processes running on your system with their command lines options. Identify the process that belongs to the IDE and note its PID.
jstack -l <PID>
Running jstack with the IDE PID will print the thread dump into console, however it's not very convenient. Use this command to redirect the output to a file:
jstack -l <PID> > dump.txt
To take several dumps repeat this command with different file names, like dump1.txt, dump2.txt, etc.
Automatic thread dumps
IDE runs a special thread that detects when UI is locked for a certain time and takes automatic thread dumps into the logs directory. You will find several folders with the name like threadDumps-20130312-202032-IU-123.169. Zip these folders together with the logs and attach to you problem report.
Thread dump from the console
If jstack doesn't work, it's possible to start IDE from the console/terminal and take a dump using platform specific ways.
Use the .bat file named for the product and located in IDE_HOME\bin directory (idea.bat, phpstorm.bat, webstorm.bat, pycharm.bat, rubymine,bat).
Press Ctrl+Break (NOT Ctrl+C) in the console to take a thread dump. Dumps can be long, running with output redirection to a file is recommended, like:
idea.bat > output.txt 2>&1
You can record several dumps in the same file by pressing Ctrl+Break multiple times.
Mac OS X
Browse to the /Applications/<PRODUCT>.app/Contents/MacOS/<product> executable in Finder, in the context menu choose Open With, Terminal. To get a thread dump press Ctrl+\ in the Terminal window.
Linux, Solaris, Generic Unix
Start the IDE from the terminal using the .sh script in the product bin directory. Start another terminal, find the IDE java process ID using jps, ps or your other favorite process manager. Send the QUIT signal to the IDE process:
kill -QUIT <PID>
Thread dump should be printed into the first terminal window from where IDE was started. Use process output to a file redirection to capture long dumps.