postgresql/src
Tom Lane 39cd1bdb86 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
..
backend On Windows, ensure shared memory handle gets closed if not being used. 2015-10-13 11:21:33 -04:00
bin Fix "pg_ctl start -w" to test child process status directly. 2015-10-12 18:30:37 -04:00
include On Windows, ensure shared memory handle gets closed if not being used. 2015-10-13 11:21:33 -04:00
interfaces Stamp 9.2.14. 2015-10-05 15:15:56 -04:00
makefiles Don't use deprecated dllwrap on Cygwin. 2014-02-01 16:13:46 -05:00
pl Translation updates 2015-10-05 11:00:57 -04:00
port Stamp 9.2.14. 2015-10-05 15:15:56 -04:00
template AIX: Test the -qlonglong option before use. 2015-07-17 03:02:18 -04:00
test Fix potential infinite loop in regular expression execution. 2015-10-02 14:26:36 -04:00
timezone Update time zone data files to tzdata release 2015g. 2015-10-02 19:16:18 -04:00
tools Turn install.bat into a pure one line wrapper fort he perl script. 2015-07-07 16:37:34 +03:00
tutorial Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix some oversights in distprep and maintainer-clean targets. 2011-03-10 00:04:05 -05:00
Makefile.global.in Make numeric form of PG version number readily available in Makefiles. 2015-07-05 12:01:01 -04:00
Makefile.shlib Unlink static libraries before rebuilding them. 2015-03-01 13:07:00 -05:00
nls-global.mk Lots of doc corrections. 2012-04-23 22:43:09 -04:00
win32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00