Getting a thread dump when IDE hangs and doesn't respond

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.

jstack

This command line utility is provided with the JDK installation and can be found in JAVA_HOME\bin directory. 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.

jps -mv

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.

Windows

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

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.

Have more questions? Submit a request

7 Comments

  • IDE hangs and doesn't respond, how to fix this issue from last 1 day i am struggling with it. how to kill the thread dumps

  • Please contact support by creating a ticket and attach the thread dumps.

  • 10.0.3 Webstorm is horribly laggy.  Unresponsive for a few seconds often.  Unusable.  I don't have time to debug your product.

  • I have to agree with Darcey here, editing javscript files within PyCharm is waaay slower than even in pycharm 4.0 and hangs so often and hard I have to kill -9 pycharm. It's getting to the point that If you don't improve performance substantially, I"m going to move on to another IDE.

  • It's the same here.

    I'm using PyCharm 4.5 Professional with a lot of CoffeeScript and Python files and it freezes regularly until the point where I have to kill PyCharm. Without performance updates we will also switch to an alternative.

  • Why is PyCharm 4.5 so so slow? Just upgraded to the newer version and am now fighting with the program to do some work!

    It hogs the CPU when it feels like it. Any ideas to make PyCharm run smoother and faster??

  • Bug report submitted yesterday, all logs/dums are included per instructions above.

    https://youtrack.jetbrains.com/issue/PY-16445

Article is closed for comments.