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:
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).
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
... is a monitoring tool that is part of JDK installation. The documentation:
- jstack from JDK1.5.0
- jstack from JDK6.0
- 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
... allows to get thread dump even without console. It works on all platforms and for all JDKs.
- launch from http://www.adaptj.com/root/webstart/stacktrace/app/launch.jnlp
- details http://www.adaptj.com/root/main/stacktrace
To generate thread dump:
- select main menu item "Process|Thread Dump..."
- in dialog click "..." button to open process ID chooser
- select PID from the list and confirm the chooser
- click OK to request thread dump
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:
- Run VisualVM
- Invoke popup menu on the program node
- Select Thread Dump
Profile Me Now! - since NetBeans 6.7
(in case you are facing slowness this is prefered 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.
- Make sure the Memory toolbar is displayed. In case the button is not visible go to Tools/Plugins and enable Java Profiler.
- Click on the button to let the system start capturing thread dumps from the running IDE.
- Work in the IDE, emulate an action which seems to be slow.
- Press the button again to turn the self profiling off.
- System then generates standard NetBeans Profiler snapshot and shows it.
- Attach the dump to issuezilla's bug report.
... for details see
FitnessViaPartnership