0

Some times when I check my PostgreSQL data directory, I see some files there names started with core. and continued with a number as its extention. for example:

-bash-4.2$ ls -la /var/lib/pgsql/14/data/
total 631408
drwx------ 20 postgres postgres      4096 Aug 13 00:00 .
drwxr-xr-x  4 postgres postgres      4096 Aug 13 13:33 ..
-rw-r-----  1 postgres postgres         3 Jul 25 13:49 PG_VERSION
-rw-------  1 postgres postgres       222 Jul 25 13:49 backup_label.old
-rw-------  1 postgres postgres    236317 Jul 25 14:27 backup_manifest
drwxr-x---  8 postgres postgres      4096 Jul 26 12:19 base
-rw-------  1 postgres postgres 654413824 Aug 12 20:20 core.85508
-rw-------  1 postgres postgres        30 Aug 13 00:00 current_logfiles
drwxr-x---  2 postgres postgres      4096 Aug 12 20:28 global
drwxr-x---  2 postgres postgres      4096 Jul 25 13:49 log
drwxr-x---  2 postgres postgres      4096 Jul 25 14:27 pg_commit_ts
drwxr-x---  2 postgres postgres      4096 Jul 25 13:49 pg_dynshmem
-rw-------  1 postgres postgres       102 Jul 25 13:49 pg_hba.conf
-rw-r-----  1 postgres postgres      1636 Jul 25 13:49 pg_ident.conf
drwxr-x---  4 postgres postgres      4096 Aug 13 13:31 pg_logical
drwxr-x---  4 postgres postgres      4096 Jul 25 13:49 pg_multixact
drwxr-x---  2 postgres postgres      4096 Jul 25 13:49 pg_notify
drwxr-x---  3 postgres postgres      4096 Jul 26 09:54 pg_replslot
drwxr-x---  2 postgres postgres      4096 Jul 25 13:49 pg_serial
drwxr-x---  2 postgres postgres      4096 Jul 25 14:27 pg_snapshots
drwxr-x---  2 postgres postgres      4096 Aug 12 20:27 pg_stat
drwxr-x---  2 postgres postgres      4096 Aug 13 13:34 pg_stat_tmp
drwxr-x---  2 postgres postgres      4096 Aug 13 05:31 pg_subtrans
drwxr-x---  2 postgres postgres      4096 Jul 25 13:49 pg_tblspc
drwxr-x---  2 postgres postgres      4096 Jul 25 13:49 pg_twophase
drwxr-x---  3 postgres postgres    131072 Aug 13 13:34 pg_wal
drwxr-x---  2 postgres postgres      4096 Aug  7 01:31 pg_xact
-rw-------  1 postgres postgres      1354 Jul 26 09:52 postgresql.auto.conf
-rw-r-----  1 postgres postgres     28710 Jul 25 14:27 postgresql.conf
-rw-------  1 postgres postgres        69 Jul 26 09:15 postmaster.opts
-rw-------  1 postgres postgres        94 Aug 12 20:28 postmaster.pid

What are these files? How can I remove them?

1 Answer 1

0

Those are core dumps. They result from postgresql crashing, and it writing out memory as a debugging aid. You can inspect the core dump with, for example gdb to help figure out why it crashed.

PostgreSQL should almost never crash in this way, so it is mildly alarming that it has done so. The least alarming reason could be as the result of the OOM killer, which should be recorded in the sys log, such as '/var/log/syslog'.

It could also be due to a bug in PostgreSQL, make sure you are running 14.9 (the most recent bugfix release of v14) to rule out known bugs.

1
  • 2
    AFAIC, no core file is created when OOM occurs: unix.stackexchange.com/a/305986 Therefore, this is probably some kind of data corruption, a hardware error, or a postgresql bug. But, most likely, debug symbols for postgresql are not installed. Without this, the backtrace is unreadable and it is impossible to write a useful bug report. If the segfault repeats, then it will be possible to investigate.
    – Melkij
    Aug 13, 2023 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.