Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE
Date
Msg-id abev_E-SE94zHP0n@paquier.xyz
Whole thread Raw
In response to RE: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE  ("Aya Iwata (Fujitsu)" <iwata.aya@fujitsu.com>)
List pgsql-hackers
On Fri, Mar 13, 2026 at 11:38:51AM +0000, Aya Iwata (Fujitsu) wrote:
> On March 10th, the bgworker test "t/002_worker_terminate.pl" failed on the Build Farm.
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jay&dt=2026-03-10%2019%3A26%3A19

Indeed.

> We are currently attempting to reproduce this issue and are considering a fix.
>
> According to the log, the test failed because the bgworker cannot be terminated
> within the time frame (5 seconds) when ALTER DATABASE RENAME is executed.
>
> So I suspect that there is a lock conflict.

Aye, we have a timing issue here, and at first it seemed to me that
this was a bug in the backend logic.  But actually I suspect that it
is simpler than that: we don't disable autovacuum so couldn't an
autovacuum worker connect to the database "testdb" that we are trying
to rename in this query?  I cannot be 100% sure because we have
reduced the log activity for the sake of the tests, but that feels
possible to me.  We could try to disable autovacuum entirely, then see
if the situation gets better in the buildfarm.

The failure rate is so low that it is likely going to take a few weeks
to check the stability of the situation.  We could also lot more
things, of course, as a temporary solution.

What do you think?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: Improve OAuth discovery logging
Next
From: Zsolt Parragi
Date:
Subject: Re: Improve OAuth discovery logging