postgresql/src/include
Tom Lane 4e95733b08 In the postmaster, rely on the signal infrastructure to block signals.
POSIX sigaction(2) can be told to block a set of signals while a
signal handler executes.  Make use of that instead of manually
blocking and unblocking signals in the postmaster's signal handlers.
This should save a few cycles, but more importantly it prevents
recursive invocation of signal handlers when many signals arrive in
close succession.  (Assuming that the platform's signal infrastructure
is designed to avoid consuming stack space in that case, but this is
demonstrably true at least on Linux.)  The existing code has been seen
to recurse to the point of stack overflow, either in the postmaster
or in a forked-off child.

Back-patch of commit 9abb2bfc0.  At the time, we'd only seen excess
postmaster stack consumption in the buildfarm; but we now have a
user report of it, and that commit has aged enough to have a fair
amount of confidence that it doesn't break anything.

This still doesn't change anything about the way that it works on
Windows.  Perhaps someone else would like to fix that?

Per bug #16673 from David Geier.  Back-patch to 9.6.  Although
the problem exists in principle before that, we've only seen it
actually materialize in connection with heavy use of parallel
workers, so it doesn't seem necessary to do anything in 9.5;
and the relevant code is different there, too.

Discussion: https://postgr.es/m/16673-d278c604f8e34ec0@postgresql.org
Discussion: https://postgr.es/m/14878.1570820201@sss.pgh.pa.us
2020-10-15 12:50:57 -04:00
..
access C comment: remove mention of use of t_hoff WAL structure member 2020-08-31 17:51:31 -04:00
bootstrap Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
catalog Avoid direct C access to possibly-null pg_subscription_rel.srsublsn. 2020-07-21 11:40:47 -04:00
commands Mark assorted variables PGDLLIMPORT. 2017-12-05 09:24:05 -05:00
common Move connect.h from fe_utils to src/include/common. 2020-08-10 09:22:59 -07:00
datatype Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
executor Fix failure with initplans used conditionally during EvalPlanQual rechecks. 2018-09-15 13:42:34 -04:00
fe_utils Empty search_path in Autovacuum and non-psql/pgbench clients. 2018-02-26 07:39:47 -08:00
foreign Separate reinitialization of shared parallel-scan state from ExecReScan. 2017-08-30 13:18:16 -04:00
lib Rename rbtree.c functions to use "rbt" prefix not "rb" prefix. 2018-11-06 13:25:24 -05:00
libpq In the postmaster, rely on the signal infrastructure to block signals. 2020-10-15 12:50:57 -04:00
mb Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
nodes Be more careful about the shape of hashable subplan clauses. 2020-08-14 22:14:03 -04:00
optimizer Be more careful about the shape of hashable subplan clauses. 2020-08-14 22:14:03 -04:00
parser Fix handling of CREATE TABLE LIKE with inheritance. 2020-08-21 15:00:43 -04:00
port Avoid need for valgrind suppressions for pg_atomic_init_u64 on some platforms. 2020-06-08 20:03:09 -07:00
portability Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postmaster Log when a BRIN autosummarization request fails 2018-03-14 12:00:53 -03:00
regex Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
replication Fix bogus cache-invalidation logic in logical replication worker. 2020-09-16 12:07:31 -04:00
rewrite Defend against self-referential views in relation_is_updatable(). 2019-11-21 16:21:44 -05:00
snowball Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
statistics Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
storage C comment: correct use of 64-"byte" cache line size 2020-09-04 13:27:52 -04:00
tcop Fix event triggers for partitioned tables 2018-10-06 19:17:46 -03:00
tsearch Fix serious performance problems in json(b) to_tsvector(). 2017-07-18 12:45:51 -04:00
utils Add missing #include. 2020-06-04 17:57:19 -04:00
.gitignore Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
c.h Fix integer-overflow edge case detection in interval_mul and pgbench. 2019-11-07 11:23:02 -05:00
fmgr.h Fix minor violations of FunctionCallInvoke usage protocol. 2020-04-21 14:23:42 -04:00
funcapi.h Avoid holding a directory FD open across assorted SRF calls. 2020-03-16 21:05:55 -04:00
getaddrinfo.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
getopt_long.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
Makefile Add statistics subdirectory to Makefile. 2017-06-08 11:29:50 -04:00
miscadmin.h Add unlikely() to CHECK_FOR_INTERRUPTS() 2020-06-05 16:49:35 -04:00
pg_config.h.in Replace use of sys_siglist[] with strsignal(). 2020-07-15 22:05:12 -04:00
pg_config.h.win32 Stamp 10.14. 2020-08-10 17:19:16 -04:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Fix default minimum value for descending sequences 2017-01-23 14:00:58 -05:00
pg_getopt.h Use our own getopt() on OpenBSD. 2019-01-18 15:06:26 -05:00
pg_trace.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pgstat.h Add GUC variables for stat tracking and timeout as PGDLLIMPORT 2020-01-21 13:47:05 +09:00
pgtar.h Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
pgtime.h Mark assorted variables PGDLLIMPORT. 2017-12-05 09:24:05 -05:00
port.h In the postmaster, rely on the signal infrastructure to block signals. 2020-10-15 12:50:57 -04:00
postgres.h Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
rusagestub.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
windowapi.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00