Re: Flaky 003_start_stop.pl test

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Jelte Fennema-Nio <postgres@jeltef.nl>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Heikki Linnakangas <hlinnaka@iki.fi>
Date: 2025-03-03T16:48:20Z
Lists: pgsql-hackers
Hi,

On 2025-02-24 11:26:56 +0100, Jelte Fennema-Nio wrote:
> The test introduced in bb86141 turns out to be flaky in CI[1] with the
> following error message:
>
> [03:40:43.047] stderr:
> [03:40:43.047] # Failed test 'connect : matches'
> [03:40:43.047] # at
> /tmp/cirrus-ci-build/src/test/postmaster/t/003_start_stop.pl line 78.
> [03:40:43.047] # 'psql: error: connection to server on socket
> "/tmp/X7O4HUuFUZ/.s.PGSQL.25995" failed: FATAL: role "invalid_user"
> does not exist'
> [03:40:43.047] # doesn't match '(?^:FATAL: sorry, too many clients already)'
> [03:40:43.047] # Looks like you failed 1 test of 25.
> [03:40:43.047]
> [03:40:43.047] (test program exited with status code 1)
>
> [1]: https://cirrus-ci.com/task/5571017969500160?logs=test_world#L256

A possibly related test failure is:

https://cirrus-ci.com/task/5005337046024192?logs=check_world#L259

[04:12:26.438] ------------------------------------- 8< -------------------------------------
[04:12:26.438] stderr:
[04:12:26.438] #   Failed test 'reserved_connections limit: matches'
[04:12:26.438] #   at C:/cirrus/src/test/postmaster/t/002_connection_limits.pl line 63.
[04:12:26.438] #                   'psql: error: connection to server on socket "C:/Windows/TEMP/jFcAsvY5h5/.s.PGSQL.21116" failed: server closed the connection unexpectedly
[04:12:26.438] # 	This probably means the server terminated abnormally
[04:12:26.438] # 	before or while processing the request.'
[04:12:26.438] #     doesn't match '(?^:FATAL:  remaining connection slots are reserved for roles with the SUPERUSER attribute)'
[04:12:26.438] # Looks like you failed 1 test of 27.
[04:12:26.438]
[04:12:26.438] (test program exited with status code 1)
[04:12:26.438] ------------------------------------------------------------------------------

Greetings,

Andres Freund



Commits

  1. Make postmaster 003_start_stop.pl test less flaky

  2. On Windows, close the client socket explicitly during backend shutdown.