Bug 257194

Summary: databases/postgresql13-server: server process was terminated by signal 11: Segmentation fault
Product: Ports & Packages Reporter: O. Hartmann <ohartmann>
Component: Individual Port(s)Assignee: pgsql
Status: Closed Not A Bug    
Severity: Affects Many People CC: elliswalker199, girgen, mathersondferwqe
Priority: --- Flags: bugzilla: maintainer-feedback? (pgsql)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 256844    

Description O. Hartmann 2021-07-14 21:12:00 UTC
Host is running FreeBSD 14-CURRENT (FreeBSD 14.0-CURRENT #84 main-n247978-b345b7e9e9c: Wed Jul 14 07:00:58 CEST 2021 amd64), KTLS enabled. Running port databases/postgresql13-server:

Jul 14 22:53:54 <16.6> host postgres[60832]: [2-1] 2021-07-14 22:54:21.477 CEST [60832] LOG:  \
   starting PostgreSQL 13.3 on amd64-portbld-freebsd14.0, compiled by FreeBSD clang version 12.0.1 \
   (git@github.com:llvm/llvm-project.git llvmorg-12.0.1-rc2-0-ge7dac564cd0e), 64-bit

with options:

 # make showconfig
===> The following configuration options are available for postgresql13-server-13.3_1:
     DEBUG=off: Build with debugging support
     DOCS=on: Build and/or install documentation
     DTRACE=off: Build with DTrace probes
     GSSAPI=on: Build with GSSAPI support
     INTDATE=on: Builds with 64-bit date/time type
     LDAP=on: Build with LDAP authentication support
     LLVM=on: Build with support for JIT-compiling expressions
     NLS=on: Use internationalized messages
     OPTIMIZED_CFLAGS=on: Builds with compiler optimizations (-O3)
     PAM=on: Build with PAM Support
     SSL=on: Build with OpenSSL support
     TZDATA=on: Use internal timezone database
     XML=on: Build with XML data type
===> Use 'make config' to modify these settings

results in a non-usable PostgreSQL server since it periodically segfaults:

[...]
Jul 14 22:54:22 <16.6> host postgres[75483]: [16-1] 2021-07-14 22:54:49.591 CEST [75483] LOG:  redo done at 1/827D0370
Jul 14 22:54:22 <16.6> host postgres[60832]: [12-1] 2021-07-14 22:54:49.852 CEST [60832] LOG:  database system is ready to accept connections
Jul 14 22:54:51 <16.6> host postgres[60832]: [13-1] 2021-07-14 22:55:18.170 CEST [60832] LOG:  server process (PID 93689) was terminated by signal 11: Segmentation fault
Jul 14 22:54:51 <16.6> host postgres[60832]: [14-1] 2021-07-14 22:55:18.170 CEST [60832] LOG:  terminating any other active server processes
Jul 14 22:54:51 <16.5> host postgres[85999]: [12-1] 2021-07-14 22:55:18.170 CEST [85999] WARNING:  terminating connection because of crash of another server process
Jul 14 22:54:51 <16.5> host postgres[85999]: [12-2] 2021-07-14 22:55:18.170 CEST [85999] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
Jul 14 22:54:51 <16.5> host postgres[85999]: [12-3] 2021-07-14 22:55:18.170 CEST [85999] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
Jul 14 22:54:51 <16.6> host postgres[60832]: [15-1] 2021-07-14 22:55:18.172 CEST [60832] LOG:  all server processes terminated; reinitializing
Jul 14 22:54:51 <16.6> host postgres[94255]: [16-1] 2021-07-14 22:55:18.185 CEST [94255] LOG:  database system was interrupted; last known up at 2021-07-14 22:54:49 CEST
Jul 14 22:54:51 <16.6> host postgres[94255]: [17-1] 2021-07-14 22:55:18.579 CEST [94255] LOG:  database system was not properly shut down; automatic recovery in progress
Jul 14 22:54:51 <16.6> host postgres[94255]: [18-1] 2021-07-14 22:55:18.597 CEST [94255] LOG:  redo starts at 1/827D0420
Jul 14 22:54:51 <16.6> host postgres[94255]: [19-1] 2021-07-14 22:55:18.597 CEST [94255] LOG:  invalid record length at 1/827D0458: wanted 24, got 0
Jul 14 22:54:51 <16.6> host postgres[94255]: [20-1] 2021-07-14 22:55:18.597 CEST [94255] LOG:  redo done at 1/827D0420
Jul 14 22:54:51 <16.6> host postgres[60832]: [16-1] 2021-07-14 22:55:18.649 CEST [60832] LOG:  database system is ready to accept connections
[...]

That is on login, on access via other client software (for instance www/nextcloud, php74).
Comment 1 O. Hartmann 2021-07-14 22:21:03 UTC
This is actualy the very first database corruption I ever had. Not a bug, simply a db corruption.
Comment 2 Mathew Aderson 2022-09-27 02:12:46 UTC
MARKED AS SPAM
Comment 3 Palle Girgensohn freebsd_committer freebsd_triage 2022-09-27 08:32:24 UTC
Hi!

Are you sure it was a database corruption? If you have the time to post some info about the corruption, you could help others?

Palle
Comment 4 Palle Girgensohn freebsd_committer freebsd_triage 2022-09-27 08:32:31 UTC
Hi!

Are you sure it was a database corruption? If you have the time to post some info about the corruption, you could help others?

Palle
Comment 5 O. Hartmann 2022-09-27 15:31:38 UTC
(In reply to Palle Girgensohn from comment #4)

I'm not sure, but now I'm pretty sure the problem is caused by the GSSIAP=on option. I have some environments were we used to use GSSAPI-based backends, but in my environment I don't.
A while ago before that reported issue I had the same issue and forgot about the fact that enabling GSSIAPI is triggering this problem. The same is/was with PostgreSQL 14. I have an actively used LDAP backend, but I do not know whether the issue is triggered only in combination of LDAP/PAM/GSSAPI
Comment 6 O. Hartmann 2022-09-27 15:32:29 UTC
And to make it all clear: no DB corruption at all!
Comment 7 ddress: elliswalker 2022-10-03 08:46:45 UTC
MARKED AS SPAM