postgresql/src/backend/port
Tom Lane e81e8f9342 Split up process latch initialization for more-fail-soft behavior.
In the previous coding, new backend processes would attempt to create their
self-pipe during the OwnLatch call in InitProcess.  However, pipe creation
could fail if the kernel is short of resources; and the system does not
recover gracefully from a FATAL error right there, since we have armed the
dead-man switch for this process and not yet set up the on_shmem_exit
callback that would disarm it.  The postmaster then forces an unnecessary
database-wide crash and restart, as reported by Sean Chittenden.

There are various ways we could rearrange the code to fix this, but the
simplest and sanest seems to be to split out creation of the self-pipe into
a new function InitializeLatchSupport, which must be called from a place
where failure is allowed.  For most processes that gets called in
InitProcess or InitAuxiliaryProcess, but processes that don't call either
but still use latches need their own calls.

Back-patch to 9.1, which has only a part of the latch logic that 9.2 and
HEAD have, but nonetheless includes this bug.
2012-10-14 22:59:56 -04:00
..
aix Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
darwin Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
dynloader Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
hpux Redefine Datum as uintptr_t, instead of unsigned long. 2009-12-31 19:41:37 +00:00
tas Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
win32 Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
ipc_test.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
Makefile Unbreak Windows builds broken by pgpipe removal. 2012-03-29 04:11:57 -04:00
posix_sema.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
sysv_sema.c Remove leftovers of BeOS port 2012-05-14 04:50:39 +03:00
sysv_shmem.c Remove misleading hints about reducing the System V request size. 2012-07-03 10:07:47 -04:00
unix_latch.c Split up process latch initialization for more-fail-soft behavior. 2012-10-14 22:59:56 -04:00
win32_latch.c Split up process latch initialization for more-fail-soft behavior. 2012-10-14 22:59:56 -04:00
win32_sema.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
win32_shmem.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00