agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: injection_points: Clear waiter slot on error and exit 4+ messages / 1 participants [nested] [flat]
* pgsql: injection_points: Clear waiter slot on error and exit @ 2026-07-23 05:38 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 4+ messages in thread From: Michael Paquier @ 2026-07-23 05:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org injection_points: Clear waiter slot on error and exit injection_wait() only clears its slot in the waiter array after the wait loop finishes. When the waiting query is canceled or the backend is terminated (wait look has a CHECK_FOR_INTERRUPS), the slot leaks. Later wakeups of the same point then bump the counter of the leaked slot instead of the real waiter, that sleeps forever. Repeated leaks can exhaust all the slots. The code is changed so as the waiting loop is wrapped with PG_ENSURE_ERROR_CLEANUP, so as the injection point slots, that are shared resources, can be cleaned up on ERROR as much as a FATAL. An isolation test is added: cancel one waiter, terminate another waiter, then check that a later waiter still receives a wakeup. Without the fixed code, the test would fail on timeout. Author: Zsolt Parragi <zsolt.parragi@percona.com> Discussion: https://postgr.es/m/CAN4CZFO+KF=cc0-iEg28RhqRBp_fTs6D4b8b7D7DB-pGYP3Ccg@mail.gmail.com Backpatch-through: 17 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/a49b6a61094677f75807e452f333f87d4926083f Modified Files -------------- src/test/modules/injection_points/Makefile | 1 + .../injection_points/expected/wait_cleanup.out | 87 ++++++++++++++++++++++ .../modules/injection_points/injection_points.c | 31 ++++++-- src/test/modules/injection_points/meson.build | 1 + .../injection_points/specs/wait_cleanup.spec | 50 +++++++++++++ 5 files changed, 162 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: injection_points: Clear waiter slot on error and exit @ 2026-07-23 05:38 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 4+ messages in thread From: Michael Paquier @ 2026-07-23 05:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org injection_points: Clear waiter slot on error and exit injection_wait() only clears its slot in the waiter array after the wait loop finishes. When the waiting query is canceled or the backend is terminated (wait look has a CHECK_FOR_INTERRUPS), the slot leaks. Later wakeups of the same point then bump the counter of the leaked slot instead of the real waiter, that sleeps forever. Repeated leaks can exhaust all the slots. The code is changed so as the waiting loop is wrapped with PG_ENSURE_ERROR_CLEANUP, so as the injection point slots, that are shared resources, can be cleaned up on ERROR as much as a FATAL. An isolation test is added: cancel one waiter, terminate another waiter, then check that a later waiter still receives a wakeup. Without the fixed code, the test would fail on timeout. Author: Zsolt Parragi <zsolt.parragi@percona.com> Discussion: https://postgr.es/m/CAN4CZFO+KF=cc0-iEg28RhqRBp_fTs6D4b8b7D7DB-pGYP3Ccg@mail.gmail.com Backpatch-through: 17 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/703859d7c649fc44da94fe1f1b9c24dcd58d9372 Modified Files -------------- src/test/modules/injection_points/Makefile | 1 + .../injection_points/expected/wait_cleanup.out | 87 ++++++++++++++++++++++ .../modules/injection_points/injection_points.c | 39 +++++++--- src/test/modules/injection_points/meson.build | 1 + .../injection_points/specs/wait_cleanup.spec | 50 +++++++++++++ 5 files changed, 166 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: injection_points: Clear waiter slot on error and exit @ 2026-07-23 05:38 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 4+ messages in thread From: Michael Paquier @ 2026-07-23 05:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org injection_points: Clear waiter slot on error and exit injection_wait() only clears its slot in the waiter array after the wait loop finishes. When the waiting query is canceled or the backend is terminated (wait look has a CHECK_FOR_INTERRUPS), the slot leaks. Later wakeups of the same point then bump the counter of the leaked slot instead of the real waiter, that sleeps forever. Repeated leaks can exhaust all the slots. The code is changed so as the waiting loop is wrapped with PG_ENSURE_ERROR_CLEANUP, so as the injection point slots, that are shared resources, can be cleaned up on ERROR as much as a FATAL. An isolation test is added: cancel one waiter, terminate another waiter, then check that a later waiter still receives a wakeup. Without the fixed code, the test would fail on timeout. Author: Zsolt Parragi <zsolt.parragi@percona.com> Discussion: https://postgr.es/m/CAN4CZFO+KF=cc0-iEg28RhqRBp_fTs6D4b8b7D7DB-pGYP3Ccg@mail.gmail.com Backpatch-through: 17 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/bb0a3ca8d218b6c0792235d7306117e5bc36294a Modified Files -------------- src/test/modules/injection_points/Makefile | 1 + .../injection_points/expected/wait_cleanup.out | 87 ++++++++++++++++++++++ .../modules/injection_points/injection_points.c | 39 +++++++--- src/test/modules/injection_points/meson.build | 1 + .../injection_points/specs/wait_cleanup.spec | 50 +++++++++++++ 5 files changed, 166 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: injection_points: Clear waiter slot on error and exit @ 2026-07-23 05:38 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 4+ messages in thread From: Michael Paquier @ 2026-07-23 05:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org injection_points: Clear waiter slot on error and exit injection_wait() only clears its slot in the waiter array after the wait loop finishes. When the waiting query is canceled or the backend is terminated (wait look has a CHECK_FOR_INTERRUPS), the slot leaks. Later wakeups of the same point then bump the counter of the leaked slot instead of the real waiter, that sleeps forever. Repeated leaks can exhaust all the slots. The code is changed so as the waiting loop is wrapped with PG_ENSURE_ERROR_CLEANUP, so as the injection point slots, that are shared resources, can be cleaned up on ERROR as much as a FATAL. An isolation test is added: cancel one waiter, terminate another waiter, then check that a later waiter still receives a wakeup. Without the fixed code, the test would fail on timeout. Author: Zsolt Parragi <zsolt.parragi@percona.com> Discussion: https://postgr.es/m/CAN4CZFO+KF=cc0-iEg28RhqRBp_fTs6D4b8b7D7DB-pGYP3Ccg@mail.gmail.com Backpatch-through: 17 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/821a4b4d074cb89d3f85f57d22896a63e9405b6a Modified Files -------------- src/test/modules/injection_points/Makefile | 1 + .../injection_points/expected/wait_cleanup.out | 87 ++++++++++++++++++++++ .../modules/injection_points/injection_points.c | 39 +++++++--- src/test/modules/injection_points/meson.build | 1 + .../injection_points/specs/wait_cleanup.spec | 50 +++++++++++++ 5 files changed, 166 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2026-07-23 05:38 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-07-23 05:38 pgsql: injection_points: Clear waiter slot on error and exit Michael Paquier <michael@paquier.xyz> 2026-07-23 05:38 pgsql: injection_points: Clear waiter slot on error and exit Michael Paquier <michael@paquier.xyz> 2026-07-23 05:38 pgsql: injection_points: Clear waiter slot on error and exit Michael Paquier <michael@paquier.xyz> 2026-07-23 05:38 pgsql: injection_points: Clear waiter slot on error and exit Michael Paquier <michael@paquier.xyz>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox