fix: empty options not accepted by Supavisor#1260
Conversation
|
@arp242 FYI - I've almost got a clean run of the tests against Supavisor - found a number of places where connections weren't being released, etc., which would cause the session mode connection pool to run out of connections. |
|
I can't get it to work on my machine: So, hm, not sure why that fails? 🤔 Does it need to have Ideally it should use the same connection parameters as everything else, except the port being different. This is also how it can "detect" if it's running pgbouncer or supaviser or anything else, which is a bit hacky but straight-forward and works. It uses the following users for tests: Only the first one is strictly needed, for the rest the tests can be skipped if it's not supported by supaviser or too hard to set up. e.g. for pgbouncer it skips those SSL tests as I couldn't get it to work. Some tests is better than no tests. It also needs to be added to GitHub actions as a final step. |
|
Don't mind doing all of the testing/CI stuff in a separate PR by the way, and just merging the fix now. |
You need to The
It may be able to use Since Supavisor stores its own data for its own operation in whatever Postgres database it sits in front of, reusing that database for other tests could unintentionally impact Supavisor's operation, so it's best to keep it isolated for the purpose of testing. Officially, I believe Supavisor supports up to Postgres 17 at the moment, but I suspect it'll work with Postgres 18 just fine, but I don't want to find out that it doesn't and chase ghosts trying to get tests passing only to find out the issue is caused by some change in v18 that requires a change to Supavisor ...
That works for me. I'll submit the testing changes in a separate PR. |
688da94 to
9cbc6a7
Compare
That's also what libpq does; from src/interfaces/libpq/fe-protocol3.c
if (conn->pguser && conn->pguser[0])
ADD_STARTUP_OPTION("user", conn->pguser);
if (conn->dbName && conn->dbName[0])
ADD_STARTUP_OPTION("database", conn->dbName);
if (conn->replication && conn->replication[0])
ADD_STARTUP_OPTION("replication", conn->replication);
if (conn->pgoptions && conn->pgoptions[0])
ADD_STARTUP_OPTION("options", conn->pgoptions);
if (conn->send_appname) {
/* Use appname if present, otherwise use fallback */
val = conn->appname ? conn->appname : conn->fbappname;
if (val && val[0])
ADD_STARTUP_OPTION("application_name", val);
}
if (conn->client_encoding_initial && conn->client_encoding_initial[0])
ADD_STARTUP_OPTION("client_encoding", conn->client_encoding_initial);
Sending an empty value works for most systems, but not in Supavisor due
to a bug there. Easy enough to fix here, so why not.
Fixes lib#1259
Co-authored-by: Martin Tournoij <martin@arp242.net>
9cbc6a7 to
8f322ae
Compare
|
Okay, I backed out the compose.yaml changes and merged just the fix.
No, just the standard Void Linux setup. I spent 0 time looking in to it so may be something simple. None of the tests ever write to the database (all uses |
Right, but Supavisor does write to the database to store its metadata (tenant configuration, etc.) which, however unlikely, could interfere with tests as the tests are implemented assuming an empty database, but it won't be if the database is shared/being used by Supavisor. |
Supavisor will close the connection and log a :bad_startup_payload
if an empty
optionsconnection parameter is sent.Fixes #1259