agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Avoid backend hang during temp table cleanup in deferrable trans 7+ messages / 1 participants [nested] [flat]
* pgsql: Avoid backend hang during temp table cleanup in deferrable trans @ 2026-09-03 03:17 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2026-09-03 03:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid backend hang during temp table cleanup in deferrable transactions Previously, a session that had created temporary objects could hang during exit if its default transaction mode was SERIALIZABLE READ ONLY DEFERRABLE and a concurrent serializable transaction was prepared. During backend exit, temporary-relation cleanup pushed a regular transaction snapshot, which honored the session's default settings and could wait for a safe serializable snapshot. So, if the conflicting transaction was prepared, this wait could last indefinitely. The wait occurred while the backend was already exiting and interrupts were held off, so even pg_terminate_backend() could not cancel it. The backend therefore remained until the prepared transaction was resolved. Temporary-relation cleanup only needs an active MVCC snapshot for fetching TOAST data from catalog tuples while dropping temporary objects. It does not need a transaction snapshot affected by the user's default isolation settings. So, use a catalog snapshot instead, which provides the needed protection without entering the deferrable safe-snapshot wait. Backpatch to all supported versions. Bug: #19441 Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Andrey Rachitskiy <pl0h0yp1@gmail.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/19441-ec29f3b1363b4a68@postgresql.org Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/0b776de09ed3e237181def135577321bdd31b548 Modified Files -------------- src/backend/catalog/namespace.c | 10 +++- src/test/modules/test_misc/meson.build | 1 + .../test_misc/t/015_temp_schema_exit_deferrable.pl | 58 ++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid backend hang during temp table cleanup in deferrable trans @ 2026-09-03 03:17 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2026-09-03 03:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid backend hang during temp table cleanup in deferrable transactions Previously, a session that had created temporary objects could hang during exit if its default transaction mode was SERIALIZABLE READ ONLY DEFERRABLE and a concurrent serializable transaction was prepared. During backend exit, temporary-relation cleanup pushed a regular transaction snapshot, which honored the session's default settings and could wait for a safe serializable snapshot. So, if the conflicting transaction was prepared, this wait could last indefinitely. The wait occurred while the backend was already exiting and interrupts were held off, so even pg_terminate_backend() could not cancel it. The backend therefore remained until the prepared transaction was resolved. Temporary-relation cleanup only needs an active MVCC snapshot for fetching TOAST data from catalog tuples while dropping temporary objects. It does not need a transaction snapshot affected by the user's default isolation settings. So, use a catalog snapshot instead, which provides the needed protection without entering the deferrable safe-snapshot wait. Backpatch to all supported versions. Bug: #19441 Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Andrey Rachitskiy <pl0h0yp1@gmail.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/19441-ec29f3b1363b4a68@postgresql.org Backpatch-through: 14 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e65f21a274eb9de52b8286ff3b721259e6c37e82 Modified Files -------------- src/backend/catalog/namespace.c | 10 +++- src/test/modules/test_misc/meson.build | 1 + .../test_misc/t/015_temp_schema_exit_deferrable.pl | 58 ++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid backend hang during temp table cleanup in deferrable trans @ 2026-09-03 03:18 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2026-09-03 03:18 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid backend hang during temp table cleanup in deferrable transactions Previously, a session that had created temporary objects could hang during exit if its default transaction mode was SERIALIZABLE READ ONLY DEFERRABLE and a concurrent serializable transaction was prepared. During backend exit, temporary-relation cleanup pushed a regular transaction snapshot, which honored the session's default settings and could wait for a safe serializable snapshot. So, if the conflicting transaction was prepared, this wait could last indefinitely. The wait occurred while the backend was already exiting and interrupts were held off, so even pg_terminate_backend() could not cancel it. The backend therefore remained until the prepared transaction was resolved. Temporary-relation cleanup only needs an active MVCC snapshot for fetching TOAST data from catalog tuples while dropping temporary objects. It does not need a transaction snapshot affected by the user's default isolation settings. So, use a catalog snapshot instead, which provides the needed protection without entering the deferrable safe-snapshot wait. Backpatch to all supported versions. Bug: #19441 Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Andrey Rachitskiy <pl0h0yp1@gmail.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/19441-ec29f3b1363b4a68@postgresql.org Backpatch-through: 14 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d2943b94bcff19de5be3e84e2803a22010693f70 Modified Files -------------- src/backend/catalog/namespace.c | 10 +++- src/test/modules/test_misc/meson.build | 1 + .../test_misc/t/015_temp_schema_exit_deferrable.pl | 58 ++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid backend hang during temp table cleanup in deferrable trans @ 2026-09-03 03:18 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2026-09-03 03:18 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid backend hang during temp table cleanup in deferrable transactions Previously, a session that had created temporary objects could hang during exit if its default transaction mode was SERIALIZABLE READ ONLY DEFERRABLE and a concurrent serializable transaction was prepared. During backend exit, temporary-relation cleanup pushed a regular transaction snapshot, which honored the session's default settings and could wait for a safe serializable snapshot. So, if the conflicting transaction was prepared, this wait could last indefinitely. The wait occurred while the backend was already exiting and interrupts were held off, so even pg_terminate_backend() could not cancel it. The backend therefore remained until the prepared transaction was resolved. Temporary-relation cleanup only needs an active MVCC snapshot for fetching TOAST data from catalog tuples while dropping temporary objects. It does not need a transaction snapshot affected by the user's default isolation settings. So, use a catalog snapshot instead, which provides the needed protection without entering the deferrable safe-snapshot wait. Backpatch to all supported versions. Bug: #19441 Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Andrey Rachitskiy <pl0h0yp1@gmail.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/19441-ec29f3b1363b4a68@postgresql.org Backpatch-through: 14 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4639b6cfe3f310b71e1e227dd2a915b053992c9b Modified Files -------------- src/backend/catalog/namespace.c | 10 +++- src/test/modules/test_misc/meson.build | 1 + .../test_misc/t/015_temp_schema_exit_deferrable.pl | 58 ++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid backend hang during temp table cleanup in deferrable trans @ 2026-09-03 03:18 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2026-09-03 03:18 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid backend hang during temp table cleanup in deferrable transactions Previously, a session that had created temporary objects could hang during exit if its default transaction mode was SERIALIZABLE READ ONLY DEFERRABLE and a concurrent serializable transaction was prepared. During backend exit, temporary-relation cleanup pushed a regular transaction snapshot, which honored the session's default settings and could wait for a safe serializable snapshot. So, if the conflicting transaction was prepared, this wait could last indefinitely. The wait occurred while the backend was already exiting and interrupts were held off, so even pg_terminate_backend() could not cancel it. The backend therefore remained until the prepared transaction was resolved. Temporary-relation cleanup only needs an active MVCC snapshot for fetching TOAST data from catalog tuples while dropping temporary objects. It does not need a transaction snapshot affected by the user's default isolation settings. So, use a catalog snapshot instead, which provides the needed protection without entering the deferrable safe-snapshot wait. Backpatch to all supported versions. Bug: #19441 Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Andrey Rachitskiy <pl0h0yp1@gmail.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/19441-ec29f3b1363b4a68@postgresql.org Backpatch-through: 14 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a90cbbc86f996f1a20e83d47c4bc65bcb2baa0a0 Modified Files -------------- src/backend/catalog/namespace.c | 10 +++- src/test/modules/test_misc/meson.build | 1 + .../test_misc/t/015_temp_schema_exit_deferrable.pl | 58 ++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid backend hang during temp table cleanup in deferrable trans @ 2026-09-03 03:18 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2026-09-03 03:18 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid backend hang during temp table cleanup in deferrable transactions Previously, a session that had created temporary objects could hang during exit if its default transaction mode was SERIALIZABLE READ ONLY DEFERRABLE and a concurrent serializable transaction was prepared. During backend exit, temporary-relation cleanup pushed a regular transaction snapshot, which honored the session's default settings and could wait for a safe serializable snapshot. So, if the conflicting transaction was prepared, this wait could last indefinitely. The wait occurred while the backend was already exiting and interrupts were held off, so even pg_terminate_backend() could not cancel it. The backend therefore remained until the prepared transaction was resolved. Temporary-relation cleanup only needs an active MVCC snapshot for fetching TOAST data from catalog tuples while dropping temporary objects. It does not need a transaction snapshot affected by the user's default isolation settings. So, use a catalog snapshot instead, which provides the needed protection without entering the deferrable safe-snapshot wait. Backpatch to all supported versions. Bug: #19441 Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Andrey Rachitskiy <pl0h0yp1@gmail.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/19441-ec29f3b1363b4a68@postgresql.org Backpatch-through: 14 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cc1edfa6c20b57402221983750ae4d69c2ddd4e3 Modified Files -------------- src/backend/catalog/namespace.c | 10 +++- .../test_misc/t/015_temp_schema_exit_deferrable.pl | 58 ++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Avoid backend hang during temp table cleanup in deferrable trans @ 2026-09-03 03:19 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2026-09-03 03:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Avoid backend hang during temp table cleanup in deferrable transactions Previously, a session that had created temporary objects could hang during exit if its default transaction mode was SERIALIZABLE READ ONLY DEFERRABLE and a concurrent serializable transaction was prepared. During backend exit, temporary-relation cleanup pushed a regular transaction snapshot, which honored the session's default settings and could wait for a safe serializable snapshot. So, if the conflicting transaction was prepared, this wait could last indefinitely. The wait occurred while the backend was already exiting and interrupts were held off, so even pg_terminate_backend() could not cancel it. The backend therefore remained until the prepared transaction was resolved. Temporary-relation cleanup only needs an active MVCC snapshot for fetching TOAST data from catalog tuples while dropping temporary objects. It does not need a transaction snapshot affected by the user's default isolation settings. So, use a catalog snapshot instead, which provides the needed protection without entering the deferrable safe-snapshot wait. Backpatch to all supported versions. Bug: #19441 Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Andrey Rachitskiy <pl0h0yp1@gmail.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/19441-ec29f3b1363b4a68@postgresql.org Backpatch-through: 14 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/57c1072380536656df87ebc59270f966b7a0f695 Modified Files -------------- src/backend/catalog/namespace.c | 10 +++- .../test_misc/t/015_temp_schema_exit_deferrable.pl | 58 ++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2026-09-03 03:19 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-09-03 03:17 pgsql: Avoid backend hang during temp table cleanup in deferrable trans Fujii Masao <fujii@postgresql.org> 2026-09-03 03:17 pgsql: Avoid backend hang during temp table cleanup in deferrable trans Fujii Masao <fujii@postgresql.org> 2026-09-03 03:18 pgsql: Avoid backend hang during temp table cleanup in deferrable trans Fujii Masao <fujii@postgresql.org> 2026-09-03 03:18 pgsql: Avoid backend hang during temp table cleanup in deferrable trans Fujii Masao <fujii@postgresql.org> 2026-09-03 03:18 pgsql: Avoid backend hang during temp table cleanup in deferrable trans Fujii Masao <fujii@postgresql.org> 2026-09-03 03:18 pgsql: Avoid backend hang during temp table cleanup in deferrable trans Fujii Masao <fujii@postgresql.org> 2026-09-03 03:19 pgsql: Avoid backend hang during temp table cleanup in deferrable trans Fujii Masao <fujii@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox