Re: pgsql: tests: Fix race condition in postmaster/002_connection_limits

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: tests: Fix race condition in postmaster/002_connection_limits
Date: 2025-03-10 22:46:12
Message-ID: c7ba6bd0-3701-43d1-9087-017777fe9cd2@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers


On 2025-03-07 Fr 1:22 PM, Andres Freund wrote:
> tests: Fix race condition in postmaster/002_connection_limits
>
> The test occasionally failed due to unexpected connection limit errors being
> encountered after having waited for FATAL errors on another connection. These
> spurious failures were caused by the the backend reporting FATAL errors to the
> client before detaching from the PGPROC entry. Adding a sleep(1) before
> proc_exit() makes it easy to reproduce that problem.
>
> To fix the issue, add a helper function that waits for postmaster to notice
> the process having exited. For now this is implemented by waiting for the
> DEBUG2 message that postmaster logs in that case. That's not the prettiest
> fix, but simple. If we notice this problem elsewhere, it might be worthwhile
> to make this more general, e.g. by adding an injection point.
>

New test breaks when log_error_verbosity=verbose. It's adding an SQL
ERRCODE to the DEBUG string.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2025-03-10 23:33:57 pgsql: tests: Make postmaster/002_connection_limits deal verbose logs
Previous Message Tom Lane 2025-03-10 21:49:52 pgsql: CREATE INDEX: do update index stats if autovacuum=off.