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
Connections to Azure Postgres dbs raise NIOSSLError.uncleanShutdown
on shutdown
#150
Comments
Paging @fabianfett as well |
FYI, I've received a reply from Azure support:
Highly unlikely, as the repro case runs within a second or less.
I'm not sure what
|
I'm attaching the config (
Nothing jumps out at me but I'm also not really sure what to look for. The timeout values seem to be the same or of longer values than the test runs. |
@finestructure Thanks for your investigations. Would you mind reproducing the error with trace level logging (Be prepared it will log a lot!)? And uploading the logs. Please make sure that you remove all sensitive data before upload. |
Thanks for taking a look, @fabianfett ! Here you go:
|
@finestructure Thank you. Sadly though, those are only trace logs from the connection pool. It seems to me like the log level is not propagated to every single connection in the pool. 😔 Could you please reproduce the problem with a single connection? By connecting to the database with postgres-nio/Sources/PostgresNIO/Connection/PostgresConnection+Connect.swift Lines 3 to 10 in d97f268
Please not that you have to manually do the authentication afterwards: postgres-nio/Sources/PostgresNIO/Connection/PostgresConnection+Authenticate.swift Lines 3 to 9 in d97f268
Full example can be this: postgres-nio/Tests/PostgresNIOTests/PostgresNIOTests.swift Lines 676 to 696 in d97f268
I'm well aware that those APIs are not ideal to deal with and we already have "cleaner" alternatives prepared. However those have not been made public yet. |
Sure, here you go!
Output:
|
Whoops, forgot to set the trace - hold on. |
Updated |
I'm afraid you leaked passwords :( |
Yeah, but it's not a problem - feel free to try this. It's a db that I set up purely for this test :) |
(It'd probably be good if trace masked these though) |
Okay, long story short: There are three issues at hand here:
I'll have a pr up for 1 shortly and hope to have some time over the weekend for 2. Service hint – since I have just seen it in the example code: To make use of the certificate validation (currently disabled with https://docs.microsoft.com/en-us/azure/postgresql/concepts-ssl-connection-security |
That's great, thanks again for taking a look and finding the root cause so quickly!
Ah yes, this was just a relic from testing with a local dockerised Postgres with TLS that I forgot to switch back. It's not how we're connecting to our Azure instances :) |
Description
This is a follow-up to a discussion on Discord where I first asked about the error and was advised to raise an issue.
We've recently switched the Swift Package Index' db from a non-SSL docker Postgres instance to Azure hosted Postgres, which uses SSL. Seemingly every command (Vapor.Command.run) that we're running in batch jobs is reporting
on shutdown.
This doesn't seem to affect operation except that it's really hard to diagnose issues with all the error noise.
It's not happening in the request loops of the webserver, so it seems to be an issue with Vapor.Command.run exiting uncleanly.
It only seems to be happening with Azure dbs. Running against a local dockerized PG db with SSL (same version, 11.6) does not exhibit the problem.
I've raised an issue with Azure to see if it's a config/server issue.
To Reproduce
One example command that triggers the error is here but there's actually a stand-alone recipe to observe the error that I'm attaching as a playground.
It can also be re-created as follows:
Run Arena to create a new playground with the required dependencies:
and add:
When running, the console should print
And the expectation is that it shouldn't 😆
The text was updated successfully, but these errors were encountered: