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 also 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 also 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 which don't 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.
You can generate trap files on demand using the db2pd command with the -stack all or -dump option. In general, though, this should only be done as requested by IBM Software Support.
You can generate stack trace files with db2pd -stacks or db2pd
-dumps commands. These files have the same contents as trap
file but are generated for diagnostic purposes only. Their names will
be similar to 6881492.2.000.stack.txt
.