postgresql/src/include/storage
Tom Lane bc6b03bb81 On Windows, ensure shared memory handle gets closed if not being used.
Postmaster child processes that aren't supposed to be attached to shared
memory were not bothering to close the shared memory mapping handle they
inherit from the postmaster process.  That's mostly harmless, since the
handle vanishes anyway when the child process exits -- but the syslogger
process, if used, doesn't get killed and restarted during recovery from a
backend crash.  That meant that Windows doesn't see the shared memory
mapping as becoming free, so it doesn't delete it and the postmaster is
unable to create a new one, resulting in failure to recover from crashes
whenever logging_collector is turned on.

Per report from Dmitry Vasilyev.  It's a bit astonishing that we'd not
figured this out long ago, since it's been broken from the very beginnings
of out native Windows support; probably some previously-unexplained trouble
reports trace to this.

A secondary problem is that on Cygwin (perhaps only in older versions?),
exec() may not detach from the shared memory segment after all, in which
case these child processes did remain attached to shared memory, posing
the risk of an unexpected shared memory clobber if they went off the rails
somehow.  That may be a long-gone bug, but we can deal with it now if it's
still live, by detaching within the infrastructure introduced here to deal
with closing the handle.

Back-patch to all supported branches.

Tom Lane and Amit Kapila
2015-10-13 11:21:33 -04:00
..
backendid.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
barrier.h Mark x86's memory barrier inline assembly as clobbering the cpu flags. 2014-09-19 17:13:52 +02:00
block.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
buf.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
buf_internals.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
buffile.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
bufmgr.h Fix race condition between hot standby and restoring a full-page image. 2014-11-13 20:01:55 +02:00
bufpage.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
checksum.h Refactor checksumming code to make it easier to use externally. 2013-06-13 22:35:56 -04:00
checksum_impl.h Fix cpluspluscheck in checksum code 2013-06-30 19:34:14 -04:00
copydir.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
fd.h Fix fsync-at-startup code to not treat errors as fatal. 2015-05-28 17:33:03 -04:00
freespace.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
fsm_internals.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
indexfsm.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
ipc.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
item.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
itemid.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
itemptr.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
large_object.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
latch.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
lmgr.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
lock.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
lwlock.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
off.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
pg_sema.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
pg_shmem.h On Windows, ensure shared memory handle gets closed if not being used. 2015-10-13 11:21:33 -04:00
pmsignal.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
pos.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
predicate.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
predicate_internals.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
proc.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
procarray.h Ensure no xid gaps during Hot Standby startup 2013-06-23 11:09:24 +01:00
procsignal.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
reinit.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
relfilenode.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
s_lock.h Fix s_lock.h PPC assembly code to be compatible with native AIX assembler. 2015-08-29 16:09:25 -04:00
shmem.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
sinval.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
sinvaladt.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
smgr.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
spin.h Update copyrights for 2013 2013-01-01 17:15:01 -05:00
standby.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00