packcore

In production environments, core dumps may occasionally occur due to program bugs or other unknown reasons. A core dump not only causes query execution failures but can also lead to cluster outages. Therefore, the generated core files are critical diagnostic artifacts and must be provided to developers for troubleshooting.

The packcore tool packages core dump files for debugging and analysis by development teams.

1 Usage

packcore is a Python utility distributed with YMatrix.
The tool is located at:

$GPHOME/sbin/packcore  

Note that $GPHOME/sbin is not included in the environment variables; therefore, you must use its absolute path.

Usage example:

$GPHOME/sbin/packcore -b $GPHOME/bin/postgres postgres.core.4_1635732782.17213  

Where:

  • -b $GPHOME/bin/postgres specifies the path of the executable binary. Worker processes are forked from the postgres master process.
  • postgres.core.4_1635732782.17213 is the generated core file.

After running the command, a compressed archive file (.tgz) with the same base name as the core file will be created in the current directory. Provide this archive to the development team. It contains the core file and relevant runtime environment information.

2 Generating Core Dumps

To use the packcore tool, the operating system must first generate core dump files.

Enable core dump generation by adjusting the following configurations:

2.1 Set Core Dump Size Limit

Set the core dump size limit to unlimited:

ulimit -c unlimited  
# To make the setting persistent  
echo "ulimit -c unlimited" >> /etc/profile  

2.2 Configure Core Dump Path

Edit the sysctl configuration:

vi /etc/sysctl.conf  

Append the following kernel.core_pattern=/home/mxadmin/%e.core.%s_%t entry to the end of the file.

Apply the configuration with:

sysctl -p  

This setting determines the location and naming pattern of core files. The template supports placeholders such as:

  • %e: Executable filename
  • %s: Signal number
  • %t: UNIX timestamp