pgsql: Server-side fix for delayed NOTIFY and SIGTERM processing.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Server-side fix for delayed NOTIFY and SIGTERM processing.
Дата
Msg-id E1gDgv5-0005Xo-9J@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Server-side fix for delayed NOTIFY and SIGTERM processing.

Commit 4f85fde8e introduced some code that was meant to ensure that we'd
process cancel, die, sinval catchup, and notify interrupts while waiting
for client input.  But there was a flaw: it supposed that the process
latch would be set upon arrival at secure_read() if any such interrupt
was pending.  In reality, we might well have cleared the process latch
at some earlier point while those flags remained set -- particularly
notifyInterruptPending, which can't be handled as long as we're within
a transaction.

To fix the NOTIFY case, also attempt to process signals (except
ProcDiePending) before trying to read.

Also, if we see that ProcDiePending is set before we read, forcibly set the
process latch to ensure that we will handle that signal promptly if no data
is available.  I also made it set the process latch on the way out, in case
there is similar logic elsewhere.  (It remains true that we won't service
ProcDiePending here unless we need to wait for input.)

The code for handling ProcDiePending during a write needs those changes,
too.

Also be a little more careful about when to reset whereToSendOutput,
and improve related comments.

Back-patch to 9.5 where this code was added.  I'm not entirely convinced
that older branches don't have similar issues, but the complaint at hand
is just about the >= 9.5 code.

Jeff Janes and Tom Lane

Discussion: https://postgr.es/m/CAOYf6ec-TmRYjKBXLLaGaB-jrd=mjG1Hzn1a1wufUAR39PQYhw@mail.gmail.com

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cbab94077e126bf32d5fb47695d7a43fe7cb60ac

Modified Files
--------------
src/backend/libpq/be-secure.c | 20 ++++++-----
src/backend/tcop/postgres.c   | 77 ++++++++++++++++++++++++++++---------------
2 files changed, 62 insertions(+), 35 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Sync our copy of the timezone library with IANA releasetzcode20
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pgsql: Silence perlcritic warning about missing return.