Skip to content

Commit 47522ee

Browse files
committed
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 815c2f0 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
1 parent 53c07db commit 47522ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/storage/ipc/latch.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,8 @@ WaitEventAdjustKqueue(WaitEventSet *set, WaitEvent *event, int old_events)
10851085

10861086
if (rc < 0)
10871087
{
1088-
if (event->events == WL_POSTMASTER_DEATH && errno == ESRCH)
1088+
if (event->events == WL_POSTMASTER_DEATH &&
1089+
(errno == ESRCH || errno == EACCES))
10891090
set->report_postmaster_not_running = true;
10901091
else
10911092
ereport(ERROR,

0 commit comments

Comments
 (0)