pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: [COMMITTERS] pgsql: Perform only one ReadControlFile() during startup.
Date: Sat, 16 Sep 2017 10:32:29 -0400
Message-ID: <14134.1505572349@sss.pgh.pa.us> (raw)
In-Reply-To: <E1dsbXB-0006pK-EE@gemulon.postgresql.org>
References: <E1dsbXB-0006pK-EE@gemulon.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Andres Freund <andres@anarazel.de> 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=<value optimized out>)
    at postmaster.c:3081
#7  <signal handler called>
#8  0x0000003b78ae1603 in __select_nocancel ()
    at ../sysdeps/unix/syscall-template.S:82
#9  0x00000000008a432a in pg_usleep (microsec=<value optimized out>)
    at pgsleep.c:56
#10 0x00000000006e75d7 in ServerLoop (argc=<value optimized out>, 
    argv=<value optimized out>) at postmaster.c:1705
#11 PostmasterMain (argc=<value optimized out>, argv=<value optimized out>)
    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



view thread (21+ messages)  latest in thread

Message-ID: <14134.1505572349@sss.pgh.pa.us>
Permalink:  ../14134.1505572349@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14134.1505572349@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, pgsql-hackers@postgreSQL.org
  Subject: Re: [COMMITTERS] pgsql: Perform only one ReadControlFile() during startup.
  In-Reply-To: <14134.1505572349@sss.pgh.pa.us>
  References: <E1dsbXB-0006pK-EE@gemulon.postgresql.org> <14134.1505572349@sss.pgh.pa.us>

* 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