Skip to content

Don't kill all waiting clients on temporary FATAL errors during login - #946

Merged
JelteF merged 1 commit into
pgbouncer:masterfrom
JelteF:fix-flaky-test_server_login_retry
Sep 29, 2023
Merged

JelteF merged 1 commit into
pgbouncer:masterfrom
JelteF:fix-flaky-test_server_login_retry

Conversation

@JelteF

@JelteF JelteF commented Sep 6, 2023

Copy link
Copy Markdown
Member

If the server connection returns a FATAL error in the login phase we
kill all the waiting clients and show this error to the user. The reason
is that when this happens it's usually because of some configuration
error (e.g. pg_hba.conf on Postgres not being configured correctly).

But there are common cases where the error is temporary too, most
importantly: "the database system is starting up"

Postgres returns a specific error code for these types of errors. This
PR starts checking for that error code, and won't disconnect the clients
when it received a FATAL error from the server with that specific error
code.

The primary reason I spent time to fix this is because it was making
our tests flaky:
https://cirrus-ci.com/task/5607330616705024

If the server connection returns a FATAL error in the login phase we
kill all the waiting clients and show this error to the user. The reason
is that when this happens it's usually because of some configuration
error (e.g. pg_hba.conf on Postgres not being configured correctly).

But there are common cases where the error is temporary too, most
importantly: "the database system is starting up"

Postgres returns a specific error code for these types of errors. This
PR starts checking for that error code, and won't disconnect the clients
when it received a FATAL error from the server with that specific error
code.

The primary reason I spent time to fix this is because it was making
our tests flaky:
https://cirrus-ci.com/task/5607330616705024
@JelteF
JelteF merged commit e761936 into pgbouncer:master Sep 29, 2023
@JelteF
JelteF deleted the fix-flaky-test_server_login_retry branch September 29, 2023 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant