postgresql/src
Andres Freund cbc47ad7ef Fix possibility of self-deadlock in ResolveRecoveryConflictWithBufferPin().
The tests added in 9f8a050f68 failed nearly reliably on FreeBSD in CI, and
occasionally on the buildfarm. That turns out to be caused not by a bug in the
test, but by a longstanding bug in recovery conflict handling.

The standby timeout handler, used by ResolveRecoveryConflictWithBufferPin(),
executed SendRecoveryConflictWithBufferPin() inside a signal handler. A bad
idea, because the deadlock timeout handler (or a spurious latch set) could
have interrupted ProcWaitForSignal(). If unlucky that could cause a
self-deadlock on ProcArrayLock, if the deadlock check is in
SendRecoveryConflictWithBufferPin()->CancelDBBackends().

To fix, set a flag in StandbyTimeoutHandler(), and check the flag in
ResolveRecoveryConflictWithBufferPin().

Subsequently the recovery conflict tests will be backpatched.

Discussion: https://postgr.es/m/20220413002626.udl7lll7f3o7nre7@alap3.anarazel.de
Backpatch: 10-
2022-05-02 18:30:38 -07:00
..
backend Fix possibility of self-deadlock in ResolveRecoveryConflictWithBufferPin(). 2022-05-02 18:30:38 -07:00
bin pg_upgrade: Upgrade an Assert to a real 'if' test 2022-03-23 19:23:51 +01:00
common Inhibit mingw CRT's auto-globbing of command line arguments 2022-04-25 15:51:58 -04:00
fe_utils Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
include Rethink the delay-checkpoint-end mechanism in the back-branches. 2022-04-14 11:10:18 -04:00
interfaces Add a temp-install prerequisite to src/interfaces/ecpg "checktcp". 2022-04-16 17:43:59 -07:00
makefiles Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:36 -04:00
pl Disallow execution of SPI functions during plperl function compilation. 2022-02-25 17:40:21 -05:00
port Stamp 10.20. 2022-02-07 16:21:57 -05:00
template Further tweaking of PG_SYSROOT heuristics for macOS. 2021-01-20 12:07:46 -05:00
test Backpatch addition of wait_for_log(), pump_until(). 2022-05-02 18:09:44 -07:00
timezone Update time zone data files to tzdata release 2021e. 2021-10-29 11:38:58 -04:00
tools Allow clean.bat to be run from anywhere 2022-01-20 10:21:28 -05:00
tutorial tutorial: land height is "elevation", not "altitude" 2021-03-10 20:25:18 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +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 Build src/test/isolation during "make" and "make install". 2017-11-22 20:18:52 -08:00
Makefile.global.in Fix prove_installcheck to use correct paths when used with PGXS 2021-07-01 08:48:24 -04:00
Makefile.shlib makefile: use proper linker flags for C++ compiles 2020-03-31 22:26:11 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00