This chapter shows you how to submit a bug report. It includes suggestions about what to try before submitting a report and which data to collect for the report.
This chapter contains the following sections:
Check for Fixes in Update Releases
Regularly scheduled updates to each release contain fixes for a set of critical bugs identified since the initial release of the platform.
When an update release becomes available, it becomes the default download at the Java SE Downloads.
The download site includes a link to the release notes that list the bug fixes in the release. Each bug in the list is linked to the bug description in the bug database. The release notes also includes the list of fixes in previous update releases. If you encounter an issue, or suspect a bug, then, as an early step in the diagnosis, check the list of fixes that are available in the most recent update release.
Note:It is always recommended to test with the available latest update release to see if the issue persists.
Prepare to Submit a Bug Report
The following is the recommended procedure to submit a bug report.
Before submitting a bug report, consider the following recommendations:
Note:First, test with the latest update release to see if the issue persists. Frequently, if a bug report is submitted for an older release, then test with the available latest available update release or even a latest available early access (EA) release. The EA release may contain new features and bug fixes.
- Collect as much relevant data as possible. For example, generate a thread dump in the case of a deadlock, or locate the core file (where applicable) and
hs_errfile in the case of a crash. In every case, it is important to document the environment and the actions performed just before the problem happened.
- Where applicable, try to restore the original state and reproduce the problem using the documented steps. This helps to determine if the problem is reproducible or an intermittent issue.
- If the issue is reproducible, try to narrow down the problem. In some cases, a bug can be demonstrated with a small standalone test case. Bugs that are demonstrated by small test cases will typically be easy to diagnose as compared to test cases that consist of a large complex application.
- Search the Java Bug Database to see if this bug or a similar bug was reported. If the bug has already been reported, then the bug report might have further information, such as the following:
If the bug was already fixed, then the release in which it was fixed is given.
A workaround for the problem.
Comments in the evaluation that explain, in further detail, the circumstances that cause the bug to happen.
- If you conclude that the bug was not already reported, then submit a new bug.
Collect Data for a Bug Report
Note:In general, it is recommended to test with the latest update release or even a latest available early access (EA) release to see if the issue persists , and then collect as much relevant data as possible when you create a bug report or submit a support call.
The following sections list the commands or recommend a general procedure to obtain the data:
The hardware details are stored in the error logs when a fatal error occurs.
Sometimes, a bug happens or can be reproduced only on certain hardware configurations. If a fatal error occurs, then the error log might contain the hardware details. If an error log is not available, then document in the bug report the number and the type of processors in the machine, the clock speed, and, where applicable and if known, some details on the features of that processor. For example, in the case of Intel processors, it might be relevant that hyper-threading is available.
Operating System Details
Operating systems provide commands that you can use to get the operating system details.
On Linux, it is important to know which distribution and version is used. Sometimes the
/etc/*release file indicates the release information, but because components and packages can be upgraded independently, it is not always a reliable indication of the configuration. Therefore, in addition to the information from the
*release file, collect the following information:
- The kernel version: This can be obtained using the
rpm -q glibccommand indicates the patch level of
- The thread library: There are two thread libraries for Linux, namely
LinuxThreadslibrary is used on 2.4, and earlier kernels and has fixed stack and floating stack variants. The Native POSIX Thread Library (
NPTL) is used on the 2.6 kernel. Some Linux releases (such as RHEL3) include backports of
NPTLto the 2.4 kernel. Use the command
getconf GNU_LIBPTHREAD_VERSIONto determine which thread library is used. If the
getconfcommand returns an error to say that the variable does not exist, then it is likely that you are using an old kernel with the
Java SE Version
Obtain the Java SE version string with the
java -version command.
Multiple versions of Java SE may be installed on the same machine. Therefore, ensure that you use the appropriate version of the
java command by verifying that the installation
bin directory appears in your
PATH environment variable before other installations.
If the bug report does not include a fatal error log then, it is important to document the full command line and all its options. This includes any options that specify heap settings (for example, the
-mx option) or any
-XX options that specify HotSpot-specific options.
One of the features in Java SE is garbage collector ergonomics. On server-class machines, the
java command launches the HotSpot Server VM and a parallel garbage collector. A machine is considered to be a server machine if it has at least two processors and 2 GB or more of memory.
-XX:+PrintCommandLineFlags option can be used to verify the command-line options. This option prints all command-line flags to the VM. The command-line options can also be obtained for a running VM or core file using the
Sometimes problems arise due to environment variable settings. When creating the bug report, indicate the values of the following Java environment variables (if set).
In addition, collect the following operating-system-specific environment variables.
- On the Linux operating system, collect the values of the following environment variables:
- On Linux, also collect the values of the following environment variables:
- On Windows, collect the values of the following environment variables:
Fatal Error Log
The fatal error log is created when a fatal error occurs.
Note:It is recommended to test with the latest update release to see if the problem persists.
When a fatal error occurs, an error log is created. See Fatal Error Log.
The error log contains information obtained at the time of the fatal error, such as version and environment information, details about the threads that provoked the crash, and so forth.
If the fatal error log is generated, then be sure to include it in the bug report or report it during a support call.
Core and Crash Dump
Core and crash dumps can be very useful when trying to diagnose a system crash or hung process.
The procedure for generating a dump is described in Collect Core Dumps.
Detailed Description of the Problem
When creating a problem description, try to include as much relevant information as possible.
Describe the application, the environment, and the most important events leading up to the time when the problem happened.
Sometimes, the problem can be reproduced only in a complex application environment. In this case, the description, coupled with logs, core file, and other relevant information, might be the only way to diagnose the issue. In these situations, the description should indicate if the submitter is willing to run further diagnosis or run test binaries on the system where the issue occurs.
- If the problem is reproducible, then list the steps that are required to demonstrate the problem.
- If the problem can be demonstrated with a small test case, then include the test case and the commands to compile and execute the test case.
- If the test case or problem requires third-party code (for example, a commercial or open source library or package), then provide then details about where and how to obtain the library.
Logs and Traces
Log or trace output can help to quickly determine the cause of a problem.
For example, in the case of a performance issue, the output of the
-verbose:gc option can help in diagnosing the problem. (This is the option to enable output from the garbage collector.)
In other cases, the output from the
jstat command can be used to capture statistical information over the time period leading up to the problem.
In the case of a deadlock or a hung VM (for example, due to a loop), the thread stacks can help diagnose the problem. The thread stacks are obtained by pressing Control+\ on Linux, and Control+Break on Windows.
In general, provide all relevant logs, traces, and other output in the bug report or during the support call.
Results from Troubleshooting Steps
Report all troubleshooting steps and results that have already occurred.
Note:Before submitting the bug report, be sure to document any troubleshooting steps that were performed.
For example, if the problem is a crash and the application has native libraries, then you might have already run the application with the
-Xcheck:jni option to reduce the likelihood that the bug is in the native code. Another case could be a crash that occurs with the HotSpot Server VM (
-server option). If you have also tested with the HotSpot Client VM (
-client option) and the problem does not occur, then this is an indication that the bug might be specific to the HotSpot Server VM.
In general, include in the bug report all troubleshooting steps and results that have already occurred. This type of information can often reduce the time that is required to diagnose an issue.
Collect Core Dumps
A core dump or a crash dump is a memory snapshot of a running process.
A core dump can be automatically created by the operating system when a fatal or unhandled error (for example, signal or system exception) occurs. Alternatively, a core dump can be forced by using system-provided command-line utilities. Sometimes, a core dump is useful when diagnosing a process that appears to be hung; the core dump may reveal information about the cause of the hang.
When collecting a core dump, be sure to gather other information about the environment so that the core file can be analyzed (for example, OS version, patch information, and the fatal error log).
Core dumps do not usually contain all the memory pages of the crashed or hung process. With each of the operating systems discussed here, the text (or code) pages of the process are not included in core dumps. But, to be useful, a core dump must consist of pages of heap and stack at as a minimum. Collecting non-truncated core dump files is essential for postmortem analysis of the crash.
The following sections describe scenarios for collecting core dumps.
Collect Core Dumps on Linux
On Linux, unhandled signals such as segmentation violation, illegal instruction, and so forth, result in a core dump.
By default, the core dump is created in the current working directory of the process and the name of the core dump file is
pid is the process ID of the crashed Java process.
ulimit utility is used to get or set the limitations on the system resources available to the current shell and its descendants. Use the
ulimit -c command to check or set the core file size limit. Ensure that the limit is set to
unlimited; otherwise, the core file could be truncated.
ulimit is a Bash shell built-in command; on a C shell, use the
Ensure that any scripts that are used to launch the VM or your application do not disable core dump creation.
You can use the
gcore command in the
gdb (GNU debugger) interface to get a core image of a running process. This utility accepts the
pid of the process for which you want to force the core dump.
To get the list of Java processes running on the machine, you can use any of the following commands:
ps -ef | grep java
jpscommand-line utility does not perform name matching (that is, looking for "java" in the process command name) and so it can list Java VM embedded processes as well as the Java processes.
You can use the
ShowMessageBoxOnError option to collect core dumps on Linux. Start a Java process with the
-XX:+ShowMessageBoxOnError command-line option. When a fatal error occurs, the process prints a message to standard error and waits for a
no response from standard input. The following example shows the output when an unexpected signal occurs.
======================================================================= Unexpected Error ----------------------------------------------------------------------- SIGSEGV (0xb) at pc=0x06232e5f, pid=11185, tid=8194 Do you want to debug the problem? To debug, run 'gdb /proc/11185/exe 11185'; then switch to thread 8194 Enter 'yes' to launch gdb automatically (PATH must include gdb) Otherwise, press RETURN to abort... =======================================================================
yes to launch the
gdb (GNU Debugger) interface, as suggested by the error report shown. In the
gdb prompt, you can give the
gcore command. This command creates a core dump of the debugged process with the name core.
pid is the process ID of the crashed process. Ensure that the
gdb gcore command is supported in your versions of
gdb. Look for
help gcore in the
gdb command prompt.
Reasons for Not Getting a Core File
The following is a list of reasons what a core file might not be generated on Linux:
The user does not have permission to write in the current working directory of the process.
The user has write permission on the current working directory, but there is already a file named
corethat has read-only permission.
The current directory does not have enough space or there is no space left.
The current directory has a subdirectory named
The current working directory is remote. It might be mapped by a Network File System (NFS), and NFS failed at the time the core dump was about to be created.
The core file size limit is too low. Check your core file size limit using the
ulimit -ccommand (Bash shell) or the
limit -ccommand (C shell). If the output from this command is not unlimited, then the core dump file size might not be large enough. If this is the case, then you will get truncated core dumps or no core dump at all. In addition, ensure that any scripts that are used to launch the VM or your application do not disable core dump creation.
The process is running a
setuidprogram, and therefore the operating system will not dump the core unless it is configured explicitly.
Java specific: If the process received
SIGILLbut no core dump, it is possible that the process handled it. For example, HotSpot VM uses the
SIGSEGVsignal for legitimate purposes, such as throwing
NullPointerException, deoptimization, and so forth. The signal is unhandled by the Java VM only if the current instruction (PC) falls outside the Java VM generated code. These are the only cases in which HotSpot dumps the core.
Java specific: The JNI Invocation API was used to create the VM. The standard Java launcher was not used. The custom Java launcher program handled the signal by consuming it and produced the log entry silently. This situation has occurred with certain application servers and web servers. These Java VM embedding programs transparently attempt to restart (fail over) the system after an abnormal termination. In this case, the fact that a core dump is not produced is a feature and not a bug.
Collect Crash Dumps on Windows
In the Windows operating system there are three types of crash dumps: Dr. Watson log file, user minidump, and Dr. Watson full dump.
Dr. Watson log file, which is a text error log file that includes faulting stack trace and a few other details.
User minidump, which is considered a partial core dump. It is not a complete core dump, because it does not contain all the useful memory pages of the process.
Dr. Watson full dump, which is equivalent to a UNIX core dump. This dump contains most memory pages of the process (except for code pages).
When an unexpected exception occurs on Windows, the action taken depends on two values in the following registry key:
The two values are named
Auto value indicates if the debugger specified in the value of the
Debugger entry starts automatically when an application error occurs.
A value of
Automeans that the system displays a message box notifying the user when an application error occurs.
A value of
Automeans that the debugger starts automatically.
The value of
Debugger is the debugger command that is to be used to debug program errors.
When a program error occurs, Windows examines the
Auto value, and if the value is
0, then it executes the command in the
Debugger value. If the value for
Debugger is a valid command, then a message box is created with two buttons: OK and Cancel. If the user clicks OK, then the program is terminated. If the user clicks Cancel, then the specified debugger is started. If the value for the
Auto entry is set to
1 and the value for the
Debugger entry specifies the command for a valid debugger, then the system automatically starts the debugger and does not generate a message box.
The following are two ways to collect crash dump on Windows.
- Configure Dr.Watson:
The Dr. Watson debugger is used to create crash dump files. By default, the Dr. Watson debugger (
drwtsn32.exe) is installed in the Windows system folder (
To install Dr. Watson as the postmortem debugger, run the following command:
To configure the name and location of crash dump files, run
drwtsn32without any options.
In the Dr. Watson GUI window, ensure that the Create Crash Dump File check box is selected and that the crash dump file path and log file path are configured in their respective text fields.
Dr. Watson can be configured to create a full dump using the registry. The registry key is shown in the following example.
System Key: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DrWatson] Entry Name: CreateCrashDump Value: (0 = disabled, 1 = enabled)
Note:If the application handles the exception, then the registry-configured debugger is not invoked. In that case, it might be appropriate to use the
-XX:+ShowMessageBoxOnErrorcommand-line option to force the process to wait for user intervention on fatal error conditions.
- Force a crash dump:
On the Windows operating system, the
userdumpcommand-line utility can be used to force a Dr. Watson dump of a running process. The
userdumputility does not ship with Windows. It is released as a component of the OEM Support Tools package.
An alternative way to force a crash dump is to use the
windbgdebugger. The main advantage of using
windbgis that it can attach to a process in a non-invasive manner (that is, read-only). Usually, Windows terminates a process after a crash dump is obtained, but with the noninvasive attach, it is possible to obtain a crash dump and let the process continue. To attach the debugger check box requires selecting the Attach to Process option and the Noninvasive checkbox.
When the debugger is attached, a crash dump can be obtained using the command shown in the following example.
.dump /f crash.dmp
windbgdebugger is included in the Debugging Tools for Windows download.
An additional utility in this download is the
dumpchk.exeutility, which can verify that a memory dump file was created correctly.
pidof the process. The
userdump -pcommand lists the process and program for all processes. This is useful if you know that the application is started with the
java.exelauncher. However, if a custom launcher is used (embedded VM), then it might be difficult to recognize the process. In that case, you can use the
jpscommand-line utility because it lists the PIDs of the Java processes only.
As with the Linux operating system, you can also use the
-XX:+ShowMessageBoxOnErrorcommand-line option on Windows. When a fatal error occurs, the process shows a message box and waits for a
noresponse from the user.
Before clicking Yes or No, you can use the
userdump.exeutility to generate the Dr. Watson dump for the Java process. This utility can also be used in cases when the process appears to be hung.