Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fUx2u-0005g6-1Q for pgsql-general@arkaria.postgresql.org; Mon, 18 Jun 2018 16:30:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fUx2r-0005Z2-TT for pgsql-general@arkaria.postgresql.org; Mon, 18 Jun 2018 16:30:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fUx2r-0005Ym-Li for pgsql-general@lists.postgresql.org; Mon, 18 Jun 2018 16:30:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fUx2n-0003FU-4V for pgsql-general@postgresql.org; Mon, 18 Jun 2018 16:30:20 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w5IGUDrc028566; Mon, 18 Jun 2018 12:30:13 -0400 From: Tom Lane To: Sherrylyn Branchaw cc: pgsql-general@postgresql.org Subject: Re: What to do when dynamic shared memory control segment is corrupt In-reply-to: References: Comments: In-reply-to Sherrylyn Branchaw message dated "Mon, 18 Jun 2018 11:34:11 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28564.1529339413.1@sss.pgh.pa.us> Date: Mon, 18 Jun 2018 12:30:13 -0400 Message-ID: <28565.1529339413@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Sherrylyn Branchaw writes: > We are using Postgres 9.6.8 (planning to upgrade to 9.6.9 soon) on RHEL 6.9. > We recently experienced two similar outages on two different prod > databases. The error messages from the logs were as follows: > LOG: server process (PID 138529) was terminated by signal 6: Aborted Hm ... were these installations built with --enable-cassert? If not, an abort trap seems pretty odd. > In one case, the logs recorded > LOG: all server processes terminated; reinitializing > LOG: incomplete data in "postmaster.pid": found only 1 newlines while > trying to add line 7 > ... > In the other case, the logs recorded > LOG: all server processes terminated; reinitializing > LOG: dynamic shared memory control segment is corrupt > LOG: incomplete data in "postmaster.pid": found only 1 newlines while > trying to add line 7 > ... Those "incomplete data" messages are quite unexpected and disturbing. I don't know of any mechanism within Postgres proper that would result in corruption of the postmaster.pid file that way. (I wondered briefly if trying to start a conflicting postmaster would result in such a situation, but experimentation here says not.) I'm suspicious that this may indicate a bug or unwarranted assumption in whatever scripts you use to start/stop the postmaster. Whether that is at all related to your crash issue is hard to say, but it bears looking into. > My question is whether the corrupt shared memory control segment, and the > failure of Postgres to automatically restart, mean the database should not > be automatically started up, and if there's something we should be doing > before restarting. No, that looks like fairly typical crash recovery to me: corrupt shared memory contents are expected and recovered from after a crash. However, we don't expect postmaster.pid to get mucked with. regards, tom lane