[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    [HACKERS] bgworker crashed or not?
From:       Antonin Houska <antonin.houska () gmail ! com>
Date:       2014-01-31 17:44:00
Message-ID: 52EBE0E0.8040303 () gmail ! com
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic