pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent - Mailing list pgsql-committers

From Nathan Bossart
Subject pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent
Date
Msg-id E1vJHUk-006I7t-3B@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Teach DSM registry to ERROR if attaching to an uninitialized entry.

If DSM entry initialization fails, backends could try to use an
uninitialized DSM segment, DSA, or dshash table (since the entry is
still added to the registry).  To fix, keep track of whether
initialization completed, and ERROR if a backend tries to attach to
an uninitialized entry.  We could instead retry initialization as
needed, but that seemed complicated, error prone, and unlikely to
help most cases.  Furthermore, such problems probably indicate a
coding error.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/dd36d384-55df-4fc2-825c-5bc56c950fa9%40gmail.com
Backpatch-through: 17

Branch
------
REL_18_STABLE

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

Modified Files
--------------
src/backend/storage/ipc/dsm_registry.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Clear 'xid' in dummy async notify entries written to fill up pag
Next
From: Nathan Bossart
Date:
Subject: pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent