IBM Support

IBM Java for AIX FAQ: Identifying and Changing the Location for Diagnostic Files (e.g., javacore, heapdump, process core files)

Question & Answer


Question

IBM Java for AIX FAQ: Identifying and Changing the Location for Diagnostic Files (e.g., javacore, heapdump, process core files)

Answer

This document explains the default path and filenames used when creating IBM Java diagnostic data and the configuration options available to use alternative locations.
Overview
Details

Default Location(s)

The default order that the IBM Java process (a.k.a., JVM) uses to write diagnostic files (e.g., javacore files, heapdump files, AIX process core files, Snap trace files) is:

1st Attempt: The current working directory (a.k.a., cwd)

In most cases, the current working directory (cwd) is likely to be the same directory used when starting the Java process. However, in some situations, the application may explicitly change the current working directory.

To identify the current working directory of a process, from a command window, execute the following command:

{replace JAVA_PID with the Java process id}

# procwdx JAVA_PID


2nd Attempt: The directory assigned to the TMPDIR process environment variable (if configured)

For situations when the current working directory is not writeable (i.e., due to permissions or the directory no longer exists or the file system is full) by the Java process, the Java process will attempt to write the diagnostic files to the directory assigned to the TMPDIR process environment variable.

This behavior can be disabled by using the IBM Java command line option -Xdump:nofailover for supported (newer) releases of IBM Java.

3rd Attempt: The /tmp file system

When the following conditions occur:

a. The process can not write to the current working directory
b. The TMPDIR process environment variable is not set, points to an invalid path, or the process can not write to the path

the JVM will attempt to write the diagnostic files to the /tmp directory.

This behavior can be disabled by using the IBM Java command line option -Xdump:nofailover for supported (newer) releases of IBM Java.

4th Attempt: No diagnostic files created

When using the default IBM Java configuration, if the Java process is unable to write to the:

a. current working directory
b. directory assigned to the TMPDIR process environment variable
c. /tmp directory

no diagnostic files will be created. For these situations, a message be printed to the application's standard error (stderr) or application log of the attempt to write the diagnostic data.

Using Alternative Filenames and Directories

The IBM Java process can be configured to use alternative filenames and directories when creating the Java diagnostic data by setting process environment variables and/or IBM Java command line options.

a. IBM Java command line -Xdump options

When the appropriate -Xdump options are used, these command line options will take precedence (be used first) over any process environment variables used.

** Important:
Using multiple -Xdump options can result in multiple, and unnecessary, diagnostic files. To prevent the duplication of files, use the -Xdump:none command line option prior to using any custom -Xdump options. Please review the (:file= and :directory= ) documentation and test -Xdump options to confirm the expected behavior.

Also, if a file and/or directory specified is not writeable (i.e., due to permissions or the directory no longer exists or the file system is full) by the Java process, the process will attempt to write the diagnostic data to the location designated by the TMPDIR process environment variable or to the /tmp directory.

{replace AGENT with one or more of java, heap, core, or snap per the documentation}
{replace DIRECTORY_AND_FILE_SPECIFICATOIN with the full path and filename of the new naming convention}
{replace DIRECTORY_SPECIFICATOIN with the existing directory to store the new files}


1. -Xdump:AGENT:file=DIRECTORY_AND_FILE_SPECIFICATION

This directs the IBM Java process to write the diagnostic file associated with the type of data or AGENT (e.g., java, heap, system, snap) to the path and file name designed by DIRECTORY_AND_FILE_SPECIFICATION.

When the path referenced in the :file= suboption does not begin with a / (forward slash), the path will be considered a relative path. As a relative path, the DIRECTORY_AND_FILE_SPECIFCATION will be appended to the default path or other configured path setting.

Examples:

-Xdump:java:file=/tmp/javacores/threaddumps
-Xdump:heap:file=/tmp/heapdumps/objectdumps
-Xdump:system:file=/tmp/corefiles/processdumps
-Xdump:snap:file=/tmp/snapfiles/javatraces



2. -Xdump:directory=DIRECTORY_SPECIFICATION

This directs the IBM Java process to write all of the diagnostic files to the directory designated by DIRECTORY_SPECIFICATION.

When the path referenced by the :directory= suboption does not begin with a / (forward slash), the path will be considered a relative path. As a relative path, the DIRECTORY_SPECIFICATION will be appended to the default path or other configured path setting.

Example:

-Xdump:directory=/tmp/allfiles

b. IBM Java process (or shell) environment variables

These process environment variables can be configured to designate an alternative directory to store diagnostic files for specific types of data.

** Important:
If a directory specified by a process environment variable is not writeable by the Java process, the process will attempt to write the diagnostic data to the location designated by the TMPDIR process environment variable or to the /tmp directory.

1. export IBM_JAVACOREDIR="DIRECTORY_TO_SAVE_JAVACORE_FILES"

Use this process environment variable to designate an alternative directory to store javacore files (e.g., javacore.###.###.###.txt).

2. export IBM_HEAPDUMPDIR="DIRECTORY_TO_SAVE_HEAPDUMP_FILES"

Use this process environment variable to designate an alternative directory to store heapdump files (e.g., heapdump.###.###.###.phd).

3. export IBM_COREDIR="DIRECTORY_TO_SAVE_CORE_OR_SNAP_FILES"

Use this process environment variable to designate an alternative directory to store AIX process core [dump] (e.g., core.###.###.###.dmp), Snap trace (e.g., Snap.###.###.###.trc), and JIT debug files.

4. export TMPDIR="FAILOVER_DIRECTORY"

Use this process environment variable to designate a failover directory other than the /tmp directory.

Summary

The feature rich and customizable IBM Java give users multiple optiions for changing the location where diagnostic data is created. Users should consider the following precedence when deciding to use alternate locations for the diagnostic data.


1. IBM Java command line parameters (e.g., -Xdump:AGENT:file= or -Xdump:directory=)

2. IBM Java process environment variables (e.g., IBM_JAVACOREDIR, IBM_HEAPDUMPDIR, IBM_COREDIR)

3. The current working directory

4. The directory assigned to the TMPDIR process environment variable

5. The /tmp directory

Section 4

Troubleshoot

The web page:

IBM Java for AIX FAQ: Troubleshooting Truncated, Missing, or Corrupted Diagnostic Files (e.g., javacore, heapdump, process core files)

provides information for:

a. Configuring and viewing the configuration of IBM Java command line options and process environment variables
b. Troubleshooting common issues associated with generating the IBM Java diagnostic files
c. Collecting and uploading additional data to assist the IBM support team with the diagnosis of any new issues

Summary

Section 7

Section 8

Section 9

Section 10

Section 11

Section 12

Section 13

Section 14

Section 15

Section 16

Section 17

Section 18

Section 19

Section 20

Section 21

Document Type: Technical Document
Content Type: General
Hardware: all Power
Operating System: all AIX Versions
IBM Java: all Java Versions
Author(s): Roger Leuckie
Reviewer(s): NA

[{"Product":{"code":"SG9NGS","label":"IBM Java"},"Business Unit":{"code":null,"label":null},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
17 June 2018

UID

isg3T1024358