pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Initialize random() in bootstrap/stand-alone postgres and in ini
Date: Mon, 24 Sep 2018 06:04:56 +0000
Message-ID: <E1g4JzM-0001vr-DC@gemulon.postgresql.org> (raw)

Initialize random() in bootstrap/stand-alone postgres and in initdb.

This removes a difference between the standard IsUnderPostmaster
execution environment and that of --boot and --single.  In a stand-alone
backend, "SELECT random()" always started at the same seed.

On a system capable of using posix shared memory, initdb could still
conclude "selecting dynamic shared memory implementation ... sysv".
Crashed --boot or --single postgres processes orphaned shared memory
objects having names that collided with the not-actually-random names
that initdb probed.  The sysv fallback appeared after ten crashes of
--boot or --single postgres.  Since --boot and --single are rare in
production use, systems used for PostgreSQL development are the
principal candidate to notice this symptom.

Back-patch to 9.3 (all supported versions).  PostgreSQL 9.4 introduced
dynamic shared memory, but 9.3 does share the "SELECT random()" problem.

Reviewed by Tom Lane and Kyotaro HORIGUCHI.

Discussion: https://postgr.es/m/20180915221546.GA3159382@rfd.leadboat.com

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d68d5adfdcaee2fac5dc47c90373a8813278ca92

Modified Files
--------------
src/backend/utils/init/miscinit.c | 8 ++++++++
src/bin/initdb/initdb.c           | 3 +++
2 files changed, 11 insertions(+)



view thread (7+ messages)  latest in thread

Message-ID: <E1g4JzM-0001vr-DC@gemulon.postgresql.org>
Permalink:  ../E1g4JzM-0001vr-DC@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1g4JzM-0001vr-DC@gemulon.postgresql.org

 · 

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: noah@leadboat.com
  Subject: Re: pgsql: Initialize random() in bootstrap/stand-alone postgres and in ini
  In-Reply-To: <E1g4JzM-0001vr-DC@gemulon.postgresql.org>
  References: <E1g4JzM-0001vr-DC@gemulon.postgresql.org>

* 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