Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9I8Q-0005vQ-Kw for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Jan 2014 17:44:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W9I8Q-0001zM-4f for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Jan 2014 17:44:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9I8O-0001zD-50 for pgsql-hackers@postgresql.org; Fri, 31 Jan 2014 17:44:08 +0000 Received: from mail-ee0-x235.google.com ([2a00:1450:4013:c00::235]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9I8L-0003Ui-Ad for pgsql-hackers@postgresql.org; Fri, 31 Jan 2014 17:44:07 +0000 Received: by mail-ee0-f53.google.com with SMTP id t10so2454212eei.12 for ; Fri, 31 Jan 2014 09:44:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=OdrfzPSJ+OoOCr2oaNc3LvuQGN/obISrel0grAnM4Mo=; b=ySOtrIdms7L8NEA99dGOSe7lBXmVnCR+LYqKAL5YBlPV40xRGoh+mAC5SvcxCi2Gq+ PGan1M6icZOFkZiUsLniSIgKY46Qlp2pMDbfbF4LbBwcKlQQVeaGBJCYXTxpZ2nj1rec 7FnDxqPpcNIveT0oFajmLjPMrDm9BIuEp4Of4Tj6XtQruUI7UnhkoCDI2G1pJFnEIbpt OhKxY+t+W+IGvpBw40VJYVxsRXcwb5W/QnxhLCCFuo3FMKdLwmWHf+JFU0INGkIExXND +EWwrJ4H8gostrFKVrunQKoAc6bJnwCbbqf61NVgfv/mTtmRWGNG15pfm7c4ofv8Gilk vhNA== X-Received: by 10.14.204.9 with SMTP id g9mr5106635eeo.82.1391190244918; Fri, 31 Jan 2014 09:44:04 -0800 (PST) Received: from [192.168.0.164] (snat.spoje.net. [77.87.240.6]) by mx.google.com with ESMTPSA id 8sm33806357eef.1.2014.01.31.09.44.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Jan 2014 09:44:03 -0800 (PST) Message-ID: <52EBE0E0.8040303@gmail.com> Date: Fri, 31 Jan 2014 18:44:00 +0100 From: Antonin Houska User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: "pgsql-hackers@postgresql.org" Subject: bgworker crashed or not? Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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 + 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