Trap files

Db2® generates a trap file if it cannot continue processing because of a trap, segmentation violation, or exception.

All signals or exceptions received by Db2 are recorded in the trap file. The trap file contains the function sequence that was running when the error occurred. This sequence is sometimes referred to as the "function call stack" or "stack trace." The trap file also contains additional information about the state of the process when the signal or exception was caught.

A trap file is generated when an application is forced to stop while running a fenced threadsafe routine. The trap occurs as the process is shutting down. This is not a fatal error and it is nothing to be concerned about.

The files are located in the directory specified by the diagpath database manager configuration parameter.

On all platforms, the trap file name begins with a process identifier (PID), followed by a thread identifier (TID), followed by the partition number (000 on single partition databases), and concluded with .trap.txt.

There are also diagnostic traps, generated by the code when certain conditions occur. These are conditions that do not warrant crashing the instance, but where it is useful to see the stack. Those traps are named with the PID in decimal format, followed by the partition number (0 in a single partition database).

Examples:

  • 6881492.2.000.trap.txt is a trap file with a process identifier (PID) of 6881492, and a thread identifier (TID) of 2.
  • 6881492.2.010.trap.txt is a trap file whose process and thread is running on partition 10.

While trap files are generated when bad signals occur, stack trace files can be generated for non-bad signals (e.g., SIGUSR1, SIGUSR2, SQLO_SIG_DUMP, SQLO_SIG_FREEZE).

You can generate stack trace files on demand with the db2pd -stack all command or the db2pd -dump all command. These files have the same contents as the trap file but are generated for diagnostic purposes only.

You can generate a stack trace for an individual engine dispatchable unit (EDU) with the db2pd -stack eduid command or the db2pd -dump eduid command. The stack trace is put into a file ending in ".stack.txt", and it contains the same content as a trap file. Stack traces should be generated for diagnostic purposes only when requested by IBM Software Support.

See db2pd - Monitor and troubleshoot Db2 database command for more detailed db2pd command syntax information.

Note: If you are sending Windows trap files to IBM® Support, ensure that you format your trap files before sending them to IBM Support in order to speed up the problem determination process. For information on how to format Windows trap files, see Formatting trap files (Windows)