Further second thoughts about idle_session_timeout patch.
authorTom Lane <[email protected]>
Thu, 7 Jan 2021 16:45:08 +0000 (11:45 -0500)
committerTom Lane <[email protected]>
Thu, 7 Jan 2021 16:45:23 +0000 (11:45 -0500)
commitb8d0cda53377515ac61357ec4a60e85ca873f486
tree1480a353560530e7491435011bc791edf7eae201
parentebb5457cfa514972847a2d03b5b4fd46f69bdc9b
Further second thoughts about idle_session_timeout patch.

On reflection, the order of operations in PostgresMain() is wrong.
These timeouts ought to be shut down before, not after, we do the
post-command-read CHECK_FOR_INTERRUPTS, to guarantee that any
timeout error will be detected there rather than at some ill-defined
later point (possibly after having wasted a lot of work).

This is really an error in the original idle_in_transaction_timeout
patch, so back-patch to 9.6 where that was introduced.
src/backend/tcop/postgres.c