Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d895f9

Browse files
committed
Initialize ListenSocket array earlier.
After commitb0bea38, syslogger prints 63 warnings about failing toclose a listen socket at postmaster startup. That's because thesyslogger process forks before the ListenSockets array is initialized,so ClosePostmasterPorts() calls "close(0)" 64 times. The first callsucceeds, because fd 0 is stdin.This has been like this since commit9a86f03 in version 13, whichmoved the SysLogger_Start() call to before initializing ListenSockets.We just didn't notice until commitb0bea38 added the LOG message.Reported by Michael Paquier and Jeff Janes.Author: Michael PaquierDiscussion:https://www.postgresql.org/message-id/ZOvvuQe0rdj2slA9%40paquier.xyzDiscussion:https://www.postgresql.org/message-id/ZO0fgDwVw2SUJiZx@paquier.xyz#482670177eb4eaf4c9f03c1eed963e5fBackpatch-through: 13
1 parent9b2a41d commit3d895f9

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,17 @@ PostmasterMain(int argc, char *argv[])
10961096
errmsg("could not remove file \"%s\": %m",
10971097
LOG_METAINFO_DATAFILE)));
10981098

1099+
/*
1100+
* Initialize input sockets.
1101+
*
1102+
* Mark them all closed, and set up an on_proc_exit function that's
1103+
* charged with closing the sockets again at postmaster shutdown.
1104+
*/
1105+
for (i=0;i<MAXLISTEN;i++)
1106+
ListenSocket[i]=PGINVALID_SOCKET;
1107+
1108+
on_proc_exit(CloseServerPorts,0);
1109+
10991110
/*
11001111
* If enabled, start up syslogger collection subprocess
11011112
*/
@@ -1130,15 +1141,7 @@ PostmasterMain(int argc, char *argv[])
11301141

11311142
/*
11321143
* Establish input sockets.
1133-
*
1134-
* First, mark them all closed, and set up an on_proc_exit function that's
1135-
* charged with closing the sockets again at postmaster shutdown.
11361144
*/
1137-
for (i=0;i<MAXLISTEN;i++)
1138-
ListenSocket[i]=PGINVALID_SOCKET;
1139-
1140-
on_proc_exit(CloseServerPorts,0);
1141-
11421145
if (ListenAddresses)
11431146
{
11441147
char*rawstring;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp