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

Server hangs up during authentication #121

Closed
paurkedal opened this issue May 27, 2022 · 5 comments
Closed

Server hangs up during authentication #121

paurkedal opened this issue May 27, 2022 · 5 comments

Comments

@paurkedal
Copy link
Contributor

When running the test suite of the current master (3f2c0fc) against a INET socket, each DB test hangs until the server disconnects with FATAL: canceling authentication due to timeout. This does not happen for UNIX domain socket. My test procedure is to start up a postgresql server like

docker run --rm -it -e POSTGRES_PASSWORD=Bw8D7YHufq11gcS4 -p 127.0.0.1:15432:5432 postgres

and run the test suite like

PGPORT=15432 PGHOST=localhost PGUSER=postgres PGDATABASE=postgres PGPASSWORD=Bw8D7YHufq11gcS4 dune runtest

The async tests report something like

ASSERT test db connection timed out after 2s
[exception] (monitor.ml.Error
  ( "Alcotest assertion failure\
   \n\027[31mFAIL\027[0m test db connection timed out after 2s\
   \n")
  ("Raised at file \"src/alcotest-engine/test.ml\", line 157, characters 20-48"
    "Called from file \"src/deferred1.ml\", line 17, characters 40-45"
    "Called from file \"src/job_queue.ml\", line 167, characters 6-47"))
            Raised at file "src/alcotest-engine/test.ml", line 157, characters 20-48
            Called from file "src/deferred1.ml", line 17, characters 40-45
            Called from file "src/job_queue.ml", line 167, characters 6-47

and the lwt tests report

[exception] End_of_file
            Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 690, characters 8-59
            Called from file "src/unix/lwt_unix.cppo.ml", line 571, characters 17-28
@gtrak
Copy link
Contributor

gtrak commented May 27, 2022

What version of postgres is it? I noticed a timeout issue with the version 14 docker image recently, but 13 works.

@gtrak
Copy link
Contributor

gtrak commented May 27, 2022

I think what's happening is we don't yet support SASL and SCRAM-SHA-256. I've debugged the handshake between 13 and 14. I think it's more involved to support it, but in the meantime I can add an error instead of the timeout. If you are in control of the server config, MD5 should still be an option for newer postgres's.
image
image

@paurkedal
Copy link
Contributor Author

Yes, it's version 14.1. An informative error would be good.

@gtrak
Copy link
Contributor

gtrak commented May 31, 2022

Testing #122 and will get it out today.

@paurkedal
Copy link
Contributor Author

Looks good, I'm getting an immediate Pgx: SASL Credential authentication not supported with the PR pinned. Thanks!

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