pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Antonin Houska <antonin.houska@gmail.com>
To: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: bgworker crashed or not?
Date: Fri, 31 Jan 2014 18:44:00 +0100
Message-ID: <52EBE0E0.8040303@gmail.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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;



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (36+ messages)  latest in thread

Message-ID: <52EBE0E0.8040303@gmail.com>
Permalink:  ../52EBE0E0.8040303@gmail.com/
Also on:    postgresql.org/message-id/52EBE0E0.8040303@gmail.com

 · 

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: pgsql-hackers@postgresql.org
  Cc: antonin.houska@gmail.com
  Subject: Re: bgworker crashed or not?
  In-Reply-To: <52EBE0E0.8040303@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox