Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtEAf-0005K4-Oq for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Sep 2017 14:34:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dtEAf-00025p-6s for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Sep 2017 14:34:13 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dtE97-0007nd-3n for pgsql-hackers@postgreSQL.org; Sat, 16 Sep 2017 14:32:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dtE94-0002zD-00 for pgsql-hackers@postgreSQL.org; Sat, 16 Sep 2017 14:32:35 +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 v8GEWTat014135; Sat, 16 Sep 2017 10:32:29 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@postgreSQL.org Subject: Re: [COMMITTERS] pgsql: Perform only one ReadControlFile() during startup. In-reply-to: References: Comments: In-reply-to Andres Freund message dated "Thu, 14 Sep 2017 21:18:53 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14133.1505572349.1@sss.pgh.pa.us> Date: Sat, 16 Sep 2017 10:32:29 -0400 Message-ID: <14134.1505572349@sss.pgh.pa.us> 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 Andres Freund writes: > Perform only one ReadControlFile() during startup. This patch or something closely related to it has broken the postmaster's ability to recover from a backend crash. For example, after exercising the backend crash Andreas just reported: regression=# select from information_schema.user_mapping_options; server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed. !> \q attempting to reconnect fails, because the postmaster isn't there. It left a core file behind though, in which I find Program terminated with signal 11, Segmentation fault. #0 0x000000000088b792 in GetMemoryChunkContext (pointer=0x7fdb36fc3f00) at ../../../../src/include/utils/memutils.h:124 124 AssertArg(MemoryContextIsValid(context)); (gdb) bt #0 0x000000000088b792 in GetMemoryChunkContext (pointer=0x7fdb36fc3f00) at ../../../../src/include/utils/memutils.h:124 #1 pfree (pointer=0x7fdb36fc3f00) at mcxt.c:951 #2 0x0000000000512843 in XLOGShmemInit () at xlog.c:4897 #3 0x0000000000737fd9 in CreateSharedMemoryAndSemaphores ( makePrivate=0 '\000', port=5440) at ipci.c:220 #4 0x00000000006e4a78 in reset_shared () at postmaster.c:2516 #5 PostmasterStateMachine () at postmaster.c:3832 #6 0x00000000006e541d in reaper (postgres_signal_arg=) at postmaster.c:3081 #7 #8 0x0000003b78ae1603 in __select_nocancel () at ../sysdeps/unix/syscall-template.S:82 #9 0x00000000008a432a in pg_usleep (microsec=) at pgsleep.c:56 #10 0x00000000006e75d7 in ServerLoop (argc=, argv=) at postmaster.c:1705 #11 PostmasterMain (argc=, argv=) at postmaster.c:1364 It's dying at "pfree(localControlFile)". localControlFile seems to be pointing at a region of memory that's entirely zeroes; certainly the data that it just moved into shared memory is all zeroes. It looks like someone didn't think hard enough about when to reset ControlFile to null. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers