postgresql/src/backend/postmaster
Fujii Masao b9cf9d7d3b Shut down transaction tracking at startup process exit.
Maxim Orlov reported that the shutdown of standby server could result in
the following assertion failure. The cause of this issue was that,
when the shutdown caused the startup process to exit, recovery-time
transaction tracking was not shut down even if it's already initialized,
and some locks the tracked transactions were holding could not be released.
At this situation, if other process was invoked and the PGPROC entry that
the startup process used was assigned to it, it found such unreleased locks
and caused the assertion failure, during the initialization of it.

    TRAP: FailedAssertion("SHMQueueEmpty(&(MyProc->myProcLocks[i]))"

This commit fixes this issue by making the startup process shut down
transaction tracking and release all locks, at the exit of it.

Back-patch to all supported branches.

Reported-by: Maxim Orlov
Author: Fujii Masao
Reviewed-by: Maxim Orlov
Discussion: https://postgr.es/m/ad4ce692cc1d89a093b471ab1d969b0b@postgrespro.ru
2021-04-06 02:27:39 +09:00
..
autovacuum.c Clean up properly error_context_stack in autovacuum worker on exception 2019-10-23 10:26:06 +09:00
bgworker.c Fix race condition between shutdown and unstarted background workers. 2020-12-24 17:00:43 -05:00
bgwriter.c Don't run atexit callbacks in quickdie signal handlers. 2018-08-08 19:09:30 +03:00
checkpointer.c Make checkpoint requests more robust. 2019-03-19 12:49:27 -04:00
fork_process.c Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
Makefile Allow background workers to be started dynamically. 2013-07-16 13:02:15 -04:00
pgarch.c Make archiver's SIGQUIT handler exit via _exit(). 2020-09-09 15:32:34 -04:00
pgstat.c Fix thinko when ending progress report for a backend 2019-09-04 15:46:54 +09:00
postmaster.c Fix race condition between shutdown and unstarted background workers. 2020-12-24 17:00:43 -05:00
startup.c Shut down transaction tracking at startup process exit. 2021-04-06 02:27:39 +09:00
syslogger.c Make syslogger more robust against failures in opening CSV log files. 2018-08-26 14:21:55 -04:00
walwriter.c Don't run atexit callbacks in quickdie signal handlers. 2018-08-08 19:09:30 +03:00