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: Avoid "could not reattach" by providing space for concurrent all
Date: Tue, 09 Apr 2019 04:44:23 +0000
Message-ID: <E1hDicR-0000pI-CK@gemulon.postgresql.org> (raw)

Avoid "could not reattach" by providing space for concurrent allocation.

We've long had reports of intermittent "could not reattach to shared
memory" errors on Windows.  Buildfarm member dory fails that way when
PGSharedMemoryReAttach() execution overlaps with creation of a thread
for the process's "default thread pool".  Fix that by providing a second
region to receive asynchronous allocations that would otherwise intrude
into UsedShmemSegAddr.  In pgwin32_ReserveSharedMemoryRegion(), stop
trying to free reservations landing at incorrect addresses; the caller's
next step has been to terminate the affected process.  Back-patch to 9.4
(all supported versions).

Reviewed by Tom Lane.  He also did much of the prerequisite research;
see commit bcbf2346d69f6006f126044864dd9383d50d87b4.

Discussion: https://postgr.es/m/20190402135442.GA1173872@rfd.leadboat.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/617dc6d299c957e2784320382b3277ede01d9c63

Modified Files
--------------
src/backend/port/win32_shmem.c      | 92 +++++++++++++++++++++++++++++++------
src/backend/postmaster/postmaster.c |  7 +++
src/include/storage/pg_shmem.h      |  1 +
3 files changed, 86 insertions(+), 14 deletions(-)



view thread (8+ messages)  latest in thread

Message-ID: <E1hDicR-0000pI-CK@gemulon.postgresql.org>
Permalink:  ../E1hDicR-0000pI-CK@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hDicR-0000pI-CK@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: Avoid "could not reattach" by providing space for concurrent all
  In-Reply-To: <E1hDicR-0000pI-CK@gemulon.postgresql.org>
  References: <E1hDicR-0000pI-CK@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