bgworker crashed or not?

From: Antonin Houska <antonin(dot)houska(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: bgworker crashed or not?
Date: 2014-01-31 17:44:00
Message-ID: 52EBE0E0.8040303@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In 9.3 I noticed that postmaster considers bgworker crashed (and
therefore tries to restart it) even if it has exited with zero status code.

I first thought about a patch like the one below, but then noticed that
postmaster.c:bgworker_quickdie() signal handler exits with 0 too (when
there's no success). Do we need my patch, my patch + <something for the
handler> or no patch at all?

// Antonin Houska (Tony)

diff --git a/src/backend/postmaster/postmaster.c
b/src/backend/postmaster/postmaster.c
index 0957e91..0313fd7 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2791,11 +2814,7 @@ reaper(SIGNAL_ARGS)

/* Was it one of our background workers? */
if (CleanupBackgroundWorker(pid, exitstatus))
- {
- /* have it be restarted */
- HaveCrashedWorker = true;
continue;
- }

/*
* Else do standard backend child cleanup.
@@ -2851,7 +2870,10 @@ CleanupBackgroundWorker(int pid,

/* Delay restarting any bgworker that exits with a
nonzero status. */
if (!EXIT_STATUS_0(exitstatus))
+ {
rw->rw_crashed_at = GetCurrentTimestamp();
+ HaveCrashedWorker = true;
+ }
else
rw->rw_crashed_at = 0;

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-01-31 17:44:22 Re: pgindent wishlist item
Previous Message Stephen Frost 2014-01-31 17:35:13 Re: Prohibit row-security + inheritance in 9.4?