pgpool: Close listening sockets before forking.

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: pgpool-committers(at)lists(dot)postgresql(dot)org
Subject: pgpool: Close listening sockets before forking.
Date: 2026-03-09 09:19:14
Message-ID: E1vzWld-008aCk-1r@gothos.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-committers

Close listening sockets before forking.

Previously, when pgpool main process forks sub processes (i.e. user
session process, pcp_main process, health check process, streaming
replication check process and life check process), they inherited
pgpool and/or pcp listening sockets. However some of processes do not
need those sockets:

- user session process - pcp sockets are unnecessary
- pcp main process - pgpool sockets are unnecessary
- health check, streaming replication check and life check process -
pgpool and pcp sockets are unnecessary

The remaining listening sockets could be a potential problem when
those process go down. Since they may keep the listening sockets for a
while, it could be possible that it prevents next pgpool starting up
from binding those ports.

Let's close those unnecessary sockets after forking. For this purpose
new function close_listening_sockets() is introduced.

Discussion: https://www.postgresql.org/message-id/20260302.100028.1346768433787074248.ishii%40postgresql.org
Backpatch-through: v4.4

Branch
------
V4_6_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=552c40db73f3e0d65ea038f2ca0780afd1efd5bb

Modified Files
--------------
src/include/pool.h | 13 ++++++++++++-
src/main/pgpool_main.c | 36 ++++++++++++++++++++++++++++++++++++
src/watchdog/wd_lifecheck.c | 6 +++++-
3 files changed, 53 insertions(+), 2 deletions(-)

Browse pgpool-committers by date

  From Date Subject
Next Message Tatsuo Ishii 2026-03-09 09:19:20 pgpool: Close listening sockets before forking.
Previous Message Tatsuo Ishii 2026-03-09 09:19:09 pgpool: Close listening sockets before forking.