@@ -243,6 +243,13 @@ bool enable_bonjour = false;
243243char * bonjour_name ;
244244bool restart_after_crash = true;
245245bool remove_temp_files_after_crash = true;
246+
247+ /*
248+ * When terminating child processes after fatal errors, like a crash of a
249+ * child process, we normally send SIGQUIT -- and most other comments in this
250+ * file are written on the assumption that we do -- but developers might
251+ * prefer to use SIGABRT to collect per-child core dumps.
252+ */
246253bool send_abort_for_crash = false;
247254bool send_abort_for_kill = false;
248255
@@ -424,7 +431,6 @@ static int BackendStartup(ClientSocket *client_sock);
424431static void report_fork_failure_to_client (ClientSocket * client_sock , int errnum );
425432static CAC_state canAcceptConnections (BackendType backend_type );
426433static void signal_child (PMChild * pmchild , int signal );
427- static void sigquit_child (PMChild * pmchild );
428434static bool SignalChildren (int signal , BackendTypeMask targetMask );
429435static void TerminateChildren (int signal );
430436static int CountChildren (BackendTypeMask targetMask );
@@ -2701,32 +2707,12 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
27012707 /*
27022708 * Signal all other child processes to exit. The crashed process has
27032709 * already been removed from ActiveChildList.
2710+ *
2711+ * We could exclude dead-end children here, but at least when sending
2712+ * SIGABRT it seems better to include them.
27042713 */
27052714 if (take_action )
2706- {
2707- dlist_iter iter ;
2708-
2709- dlist_foreach (iter , & ActiveChildList )
2710- {
2711- PMChild * bp = dlist_container (PMChild , elem , iter .cur );
2712-
2713- /* We do NOT restart the syslogger */
2714- if (bp == SysLoggerPMChild )
2715- continue ;
2716-
2717- if (bp == StartupPMChild )
2718- StartupStatus = STARTUP_SIGNALED ;
2719-
2720- /*
2721- * This backend is still alive. Unless we did so already, tell it
2722- * to commit hara-kiri.
2723- *
2724- * We could exclude dead-end children here, but at least when
2725- * sending SIGABRT it seems better to include them.
2726- */
2727- sigquit_child (bp );
2728- }
2729- }
2715+ TerminateChildren (send_abort_for_crash ? SIGABRT : SIGQUIT );
27302716
27312717 if (Shutdown != ImmediateShutdown )
27322718 FatalError = true;
@@ -3349,19 +3335,6 @@ signal_child(PMChild *pmchild, int signal)
33493335#endif
33503336}
33513337
3352- /*
3353- * Convenience function for killing a child process after a crash of some
3354- * other child process. We apply send_abort_for_crash to decide which signal
3355- * to send. Normally it's SIGQUIT -- and most other comments in this file are
3356- * written on the assumption that it is -- but developers might prefer to use
3357- * SIGABRT to collect per-child core dumps.
3358- */
3359- static void
3360- sigquit_child (PMChild * pmchild )
3361- {
3362- signal_child (pmchild , (send_abort_for_crash ? SIGABRT : SIGQUIT ));
3363- }
3364-
33653338/*
33663339 * Send a signal to the targeted children.
33673340 */
0 commit comments