postgres.git / summary / log / commit / refs
commit 70516a178ad0fc54d0f0d2a88175af3e1e92f83f
Author: Thomas Munro <tmunro@postgresql.org>
Date: Thu Oct 15 05:23:30 2020 +0000
First released in: 14.0, 13.1
Handle EACCES errors from kevent() better.
While registering for postmaster exit events, we have to handle a couple
of edge cases where the postmaster is already gone. Commit 815c2f09
missed one: EACCES must surely imply that PostmasterPid no longer
belongs to our postmaster process (or alternatively an unexpected
permissions model has been imposed on us). Like ESRCH, this should be
treated as a WL_POSTMASTER_DEATH event, rather than being raised with
ereport().
No known problems reported in the wild. Per code review from Tom Lane.
Back-patch to 13.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3624029.1602701929%40sss.pgh.pa.us
src/backend/storage/ipc/latch.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c
index eacb8c3c9ee..24d44c982da 100644
--- a/src/backend/storage/ipc/latch.c
+++ b/src/backend/storage/ipc/latch.c
@@ -1148,7 +1148,8 @@ WaitEventAdjustKqueue(WaitEventSet *set, WaitEvent *event, int old_events)
if (rc < 0)
{
- if (event->events == WL_POSTMASTER_DEATH && errno == ESRCH)
+ if (event->events == WL_POSTMASTER_DEATH &&
+ (errno == ESRCH || errno == EACCES))
set->report_postmaster_not_running = true;
else
ereport(ERROR,
[parent: d7eb52d7181d]