(Postgres) Sql persistence or Postgres transport erroneous warning

Hi. Finally getting round to trying out the postgres transport, linked to sql persistence (using postgres of course) and I get the following warning at startup.

{"timestamp":"2024-08-27T17:24:50.0269584Z","level":"WARN","message":"Maximum connection pooling value (Max Pool Size=N) is not configured on the provided connection string. The default value (100) will be used.","source":"NServiceBus.Transport.Sql.Shared.Configuration.DbConnectionFactory"}

However, this is my connection string:

Host=pgsql;Port=5432;Database=****;User ID=****;Password=****;Pooling=true;MinPoolSize=1;MaxPoolSize=200;

MaxPoolSize is (apparently) the correct parameter name, so not sure what’s going on. I’ve got another application using the same connection string, and the same version of Npgsql (8.0.3) (but not NServiceBus) and it’s happy with that connection string.

I’ve also (seemingly randomly… sorry, I know) seen the same error but for Min Pool Size=N.

Wondering if this is erroneous? Something I should be worried about?

Thanks!

Welcome @robjohnson1978 to our forum

As per the code, the parameter name should be “Max Pool Size”. Please retry the connection string using this parameter name and let us know if that fixed the warning

Thanks
Jayanthi
Particular Software Support.

Hi Jayanthi, thanks for getting back to me. I’m aware that’s what the code expects (hence the warning), but from what I can see in terms of valid parameters on a Postgres connection string, that isn’t one of them. MaxPoolSize is valid. As is, theoretically at least, Maximum Pool Size. Max Pool Size isn’t a valid parameter for a Postgres connection string. This is borne out by the error message you receive from Npgsql when attempting to use this parameter:

An exception of type System.ArgumentException was thrown: Couldn't set max pool size (Parameter 'max pool size')   InnerException of type System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.      at Npgsql.NpgsqlConnectionStringBuilder.set_Item(String keyword, Object value)\n   at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)\n   at Npgsql.NpgsqlConnectionStringBuilder..ctor(String connectionString)\n   at Npgsql.NpgsqlConnection.SetupDataSource()\n   at Npgsql.NpgsqlConnection.set_ConnectionString(String value)\n   at Npgsql.NpgsqlConnection..ctor(String connectionString)\n

I had already tried this of course. But tried again just now so I could get the error for you.

Presumably this is a defect where the validator hasn’t been updated after PG transport has been added - do I need to raise an issue in GitHub?

@robjohnson1978

Yes, I would assume that it should support both formats. You could raise a bug around this. to have the validator updated.

@Jayanthi_Sourirajan ok, no problem. Issue created.

Oh and I’ve just spotted it had already been raised. So I’ve closed my issue.