pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix DROP DATABASE FORCE failing on parallel autovacuum workers. 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix DROP DATABASE FORCE failing on parallel autovacuum workers. @ 2026-10-15 17:33 Masahiko Sawada <msawada@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Masahiko Sawada @ 2026-10-15 17:33 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix DROP DATABASE FORCE failing on parallel autovacuum workers. An autovacuum worker advertises no role in its PGPROC, but its parallel workers advertise the bootstrap superuser. So DROP DATABASE ... FORCE run by a non-superuser with pg_signal_backend failed with "permission denied to terminate process" while a parallel autovacuum was running in the database, although the same user can terminate the autovacuum worker itself, and DROP DATABASE without FORCE succeeds. Fix by checking a parallel worker against its leader's role when the leader advertises no role. The leader is in the same database and is checked too, so this doesn't let anyone terminate a process they couldn't already terminate through its leader. Parallel workers launched by a background worker connected without a user name have had the same problem in older branches, but we haven't received any report of it, and the next minor release is the final one for v14, leaving no chance to fix a mistake there. So backpatch only to v19, where parallel autovacuum made the problem easy to hit. If we get a report, we can backpatch it further. Found by Bharath using AI assisted review. Reported-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Reviewed-by: shihao zhong <zhong950419@gmail.com> Discussion: https://postgr.es/m/CALj2ACWK6PkOk5MTfibtJyTYpb=Aq_8=YaexnPKhOj11bOCROQ@mail.gmail.com Backpatch-through: 19 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/a39e53a700c5b728f2f7dab964e33b157979fb3a Modified Files -------------- src/backend/commands/vacuumparallel.c | 4 +++ src/backend/storage/ipc/procarray.c | 25 ++++++++++--- .../test_autovacuum/t/001_parallel_autovacuum.pl | 42 ++++++++++++++++++++++ 3 files changed, 67 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix DROP DATABASE FORCE failing on parallel autovacuum workers. @ 2026-10-15 17:34 Masahiko Sawada <msawada@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Masahiko Sawada @ 2026-10-15 17:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix DROP DATABASE FORCE failing on parallel autovacuum workers. An autovacuum worker advertises no role in its PGPROC, but its parallel workers advertise the bootstrap superuser. So DROP DATABASE ... FORCE run by a non-superuser with pg_signal_backend failed with "permission denied to terminate process" while a parallel autovacuum was running in the database, although the same user can terminate the autovacuum worker itself, and DROP DATABASE without FORCE succeeds. Fix by checking a parallel worker against its leader's role when the leader advertises no role. The leader is in the same database and is checked too, so this doesn't let anyone terminate a process they couldn't already terminate through its leader. Parallel workers launched by a background worker connected without a user name have had the same problem in older branches, but we haven't received any report of it, and the next minor release is the final one for v14, leaving no chance to fix a mistake there. So backpatch only to v19, where parallel autovacuum made the problem easy to hit. If we get a report, we can backpatch it further. Found by Bharath using AI assisted review. Reported-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Reviewed-by: shihao zhong <zhong950419@gmail.com> Discussion: https://postgr.es/m/CALj2ACWK6PkOk5MTfibtJyTYpb=Aq_8=YaexnPKhOj11bOCROQ@mail.gmail.com Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2761a3c351ba7424e46a8452a99a0839edc418c7 Modified Files -------------- src/backend/commands/vacuumparallel.c | 4 +++ src/backend/storage/ipc/procarray.c | 25 ++++++++++--- .../test_autovacuum/t/001_parallel_autovacuum.pl | 42 ++++++++++++++++++++++ 3 files changed, 67 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-10-15 17:34 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-10-15 17:33 pgsql: Fix DROP DATABASE FORCE failing on parallel autovacuum workers. Masahiko Sawada <msawada@postgresql.org> 2026-10-15 17:34 pgsql: Fix DROP DATABASE FORCE failing on parallel autovacuum workers. Masahiko Sawada <msawada@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox