Fix accepting INET fd bug.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Wed, 25 May 2022 01:07:19 +0000 (10:07 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Wed, 25 May 2022 01:07:19 +0000 (10:07 +0900)
This was introduced in commit: 9f727c1e267f1363012a3af599b7d7515e4ec355.

While pgpool_main initializes itself, first accepting UNIX/INET domain
sockets are set in "fds" array.  Then forks child process.  So far so
good. Later on pgpool_main initializes pcp sockets. But at this point
it accidentally initialized "fds" array again. As a result, if child
process is forked again, wrong fds were used by those child
process. Immediate result is, frontend could not connect to pgpool by
INET domain listen addresses (-h localhost).

Problem found by Bo peng.

src/main/pgpool_main.c

index ae6b55b3b8c5037ac8b6223845eb7c0aedaa7feb..92e8ccec4b7f66840f9ebecacdc7e3004106af0c 100644 (file)
@@ -471,7 +471,7 @@ PgpoolMain(bool discard_status, bool clear_memcache_oidmaps)
                                (errmsg("failed to allocate memory in startup process")));
 
        pcp_fds[0] = create_unix_domain_socket(pcp_un_addr);
-       fds[1] = -1;
+       pcp_fds[1] = -1;
        on_proc_exit(FileUnlink, (Datum) pcp_un_addr.sun_path);
 
        /* create inet domain socket if any */