public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tender Wang <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: [PATCH] Update HandleChildCrash comments
Date: Tue, 17 Mar 2026 13:24:16 +0800
Message-ID: <CAHewXNmMMg9_5ko9Rybt-1Q45f+M5=01TwyPFuEAV5Xcip7tcw@mail.gmail.com> (raw)

Hello hackers,

The existing header comments for HandleChildCrash() in postmaster.c
are somewhat outdated,
as they only list a few auxiliary processes and miss several newer
ones added in recent versions, for example: walsummarizer, and
io_worker.

Instead of maintaining an exhaustive list of process names in the
comments, which can become stale.
This patch updates the comments to point directly to the
decision-making places: process_pm_child_exit() and CleanupBackend().

I have preserved the original description regarding the function's
objectives (cleaning up local state and signaling other children).

Please see the attached patch.

-- 
Thanks,
Tender Wang


Attachments:

  [application/octet-stream] 0001-Clarify-HandleChildCrash-comments-and-reference-its-.patch (1.8K, 2-0001-Clarify-HandleChildCrash-comments-and-reference-its-.patch)
  download | inline diff:
From 35e171fd35d25a480f659304a38253fce47d07b4 Mon Sep 17 00:00:00 2001
From: Tender Wang <[email protected]>
Date: Tue, 17 Mar 2026 13:10:13 +0800
Subject: [PATCH] Clarify HandleChildCrash comments and reference its call
 sites.

The existing header comment for HandleChildCrash describes its actions
but lacks context on which process exits are considered catastrophic.
Instead of maintaining a volatile list of process names, this commit
updates the comments to point to process_pm_child_exit() and
CleanupBackend().

These functions encapsulate the logic for determining when a child's
abnormal exit requires a cluster-wide restart. The core description
of the function's objectives is preserved.
---
 src/backend/postmaster/postmaster.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 3fac46c402b..196e47d01fc 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2797,13 +2797,16 @@ HandleFatalError(QuitSignalReason reason, bool consider_sigabrt)
 }
 
 /*
- * HandleChildCrash -- cleanup after failed backend, bgwriter, checkpointer,
- * walwriter, autovacuum, archiver, slot sync worker, or background worker.
+ * HandleChildCrash -- process a crash of a child process.
  *
  * The objectives here are to clean up our local state about the child
  * process, and to signal all other remaining children to quickdie.
  *
  * The caller has already released its PMChild slot.
+ *
+ * The specific conditions and process types that trigger this are
+ * managed in process_pm_child_exit() (for auxiliary processes)
+ * and CleanupBackend() (for backends).
  */
 static void
 HandleChildCrash(int pid, int exitstatus, const char *procname)
-- 
2.34.1



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [PATCH] Update HandleChildCrash comments
  In-Reply-To: <CAHewXNmMMg9_5ko9Rybt-1Q45f+M5=01TwyPFuEAV5Xcip7tcw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox