pgsql: Initialize ListenSocket array earlier.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Initialize ListenSocket array earlier.
Date: 2023-08-29 06:13:43
Message-ID: E1qaryx-001TlA-1p@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Initialize ListenSocket array earlier.

After commit b0bea38705, syslogger prints 63 warnings about failing to
close a listen socket at postmaster startup. That's because the
syslogger process forks before the ListenSockets array is initialized,
so ClosePostmasterPorts() calls "close(0)" 64 times. The first call
succeeds, because fd 0 is stdin.

This has been like this since commit 9a86f03b4e in version 13, which
moved the SysLogger_Start() call to before initializing ListenSockets.
We just didn't notice until commit b0bea38705 added the LOG message.

Reported by Michael Paquier and Jeff Janes.

Author: Michael Paquier
Discussion: https://www.postgresql.org/message-id/ZOvvuQe0rdj2slA9%40paquier.xyz
Discussion: https://www.postgresql.org/message-id/ZO0fgDwVw2SUJiZx@paquier.xyz#482670177eb4eaf4c9f03c1eed963e5f
Backpatch-through: 13

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3d895f95a0209969dddd7534747555ed8e3c1a79

Modified Files
--------------
src/backend/postmaster/postmaster.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2023-08-29 06:36:13 pgsql: Add some const decorations
Previous Message Michael Paquier 2023-08-28 23:45:24 pgsql: Tweak pg_promote() to report failures on kill() or postmaster fa