Chapter 33. Troubleshooting

Postgres Pro offers the ability to dump the state of a backend process, which can be useful for diagnostic and debugging purposes, by enabling the crash_info configuration parameter. Then the dump state file can be generated in one of the following ways:

  • By sending the signal 40 (also known as the diagnostic dump signal):

    kill -40 backend_pid
    
  • Using the pg_diagdump() function:

    SELECT pg_diagdump(backend_pid);
    

Here backend_pid is the process ID of the backend process to dump.

As a result, Postgres Pro will write the state dump to a file in the $PGDATA/crash_info directory by default or in the directory specified in the crash_info_location configuration parameter. The file will be named following this pattern: crash_file_id_pidpid.state. You can set the data sources to provide data for a crash dump in the crash_info_dump configuration parameter.

The below example shows how to generate and inspect the state dump file for the backend with PID 23111:

-- Generate the state dump file
SELECT pg_diagdump(23111);

-- Inspect crash_info directory and its contents
SELECT pg_ls_dir('crash_info');

-- Read the contents of the state dump file
SELECT pg_read_file('crash_info/crash_1722943138419104_pid23111.state');