Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

JelteF
Copy link
Member

@JelteF JelteF commented Sep 6, 2023

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