Skip to content
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

psycopg2.OperationalError: server closed the connection unexpectedly on password authentication failure #1078

Closed
swjain23 opened this issue Apr 7, 2020 · 3 comments

Comments

@swjain23
Copy link

swjain23 commented Apr 7, 2020

Hi,

We are using psycopg2 version 2.8.5 and trying to connect to a PostgreSQL server version 10. I am able to connect using the right credentials, but when I enter a wrong password I get this error: "server closed the connection unexpectedly. This probably means the server terminated abnormally before or while processing the request." instead of the error returned by the server. I looked at my server logs and it logs this error:

2020-04-07 21:30:57 UTC-5e8cf110.8f6b8-FATAL:  password authentication failed for user "postgres"
2020-04-07 21:30:57 UTC-5e8cf110.8f6b8-DETAIL:  Password does not match for user "postgres".

Also, when I provide a wrong password to my PostgreSQL server version 9.6 I get a proper error from psycopg2: "FATAL: password authentication failed for user "postgres"".

This is an excerpt from my code:

# Connect using psycopg2
        try:
            # Pass connection parameters as keyword arguments to psycopg2.connect by unpacking the connection_options dict
            connection = psycopg2.connect(**connection_options)
        except Exception as err:
@dvarrazzo
Copy link
Member

Is the difference only between server versions? are you using the same psycopg library?

What is the pg_hba.conf configuration for both the servers? Is it the same? Is this just a normal server on the local network you are talking to or is it a more complicate networking system?

I obtain the same error on both PG 9.6 and 11: FATAL: password authentication failed for user "testpw". I think you have a different configuration for the two databases.

@dvarrazzo
Copy link
Member

Any answer to the above or can I close this bug?

@swjain23
Copy link
Author

Hi,

We hit the same error with pgadmin, looks like some configuration issue on our part. You can close the issue. Thank you.

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

No branches or pull requests

2 participants