GenerateThreadDump

Contents


When the NetBeans IDE freezes or becomes sluggish for no apparent reason, it's recommended to generate a thread dump(or profile IDE) and attach as a file to the reported bug. Please use 'Create a new attachment' link in the 'Attachments' section of the IssueZilla header. Do not copy the thread dump into the description field!

The Thread Dump

... is a textual dump of all active threads and monitors of Java apps running in a Virtual Machine.

To Generate Thread Dump

... do any of the following:

Console on Windows

  • Press Ctrl-Break in the command console you used to start the IDE
    If the console isn't opened (in case you started the IDE using the default desktop icon):
  • launch the IDE using a console window
    (invoke Command Prompt, go to {netbeans-install-dir}/bin and type nb.exe)
  • configure the desktop shortcut to launch the nb.exe instead of netbeans.exe (default)
  • NB7 and later - there is no nb.exe, just run netbeans.exe from console. If NB is started by shortcut use "--console new" option to open console (netbeans.exe --console new).
  • The thread dump is printed into the command console. Just assure that the console have the line buffer long enough so that the whole thread dump fits in.


Console on Unix, Linux, Mac OS X

  • press Ctrl-\ in the terminal console you used to start the IDE
  • send the QUIT signal to the Java VM running the IDE
    kill -QUIT process_id
    process_id is the process number of the respective java process
  • The thread dump is printed into the terminal. Just assure that the line buffer is long enough so that the whole thread dump fits in.


jps & jstack Tools

... are monitoring tools that are part of JDK installation.

  • Run jps -lm. It will print PID numbers of running Java processes.
  • Find PID of NetBeans in the output of jps, run jstack <PID>, and redirect output to a file

The documentation:

  1. jstack from JDK 5
  2. jstack from JDK 6
  3. On Mac OS X, jstack sometimes fails with an error message. As a workaround, you can generate a thread dump using killall -9 hsdbd; sudo jstack pid

StackTrace Tool

... allows to get thread dump even without console. It works on all platforms and for all JDKs.

  1. launch from http://www.adaptj.com/root/webstart/stacktrace/app/launch.jnlp
  2. details http://www.adaptj.com/root/main/stacktrace

To generate thread dump:

  1. select main menu item "Process|Select..."
  2. in dialog click "..." button to open process ID chooser
  3. select PID for e.g. 'netbeans.exe ...' from the list and confirm the chooser by OK
  4. select main menu item "Process|Thread Dump"
  5. select main menu item "Save", find suitable location from the chooser and select suitable file name


VisualVM

The VisualVM is a tool that provides a visual interface for troubleshooting, profiling and viewing detailed information about Java applications while they are running on a Java Virtual Machine. Available as part of JDK or from download page.

To generate thread dump:

  1. Run VisualVM
  2. Invoke popup menu on the program node
  3. Select Thread Dump

Profile Me Now

(since NetBeans 6.7) (in case you are facing slowness, not a freeze/deadlock, this is the preferred way to help NetBeans' developers)

There is a dedicated "Profile Me Now!" button in the toolbar to start, stop self profiling in any distribution that includes NetBeans Profiler.

  1. Make sure the Memory toolbar is displayed. In case the button is not visible go to Tools/Plugins and enable Java Profiler.
  2. Click on the button to let the system start capturing thread dumps from the running IDE.
  3. Work in the IDE, emulate an action which seems to be slow.
  4. Press the button again to turn the self profiling off.
  5. System then generates standard NetBeans Profiler snapshot and shows it.
  6. Attach the dump to issuezilla's bug report.

... for details see FaqProfileMeNow

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo