-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
Postgres max pool size option not honored #1656
Comments
Thanks, this is a duplicate for #1269 which got closed without further investigation. |
I tried around a bit and it seems the config is not respected at all. When I set it to 20, there were still 10 connections. I also tried overriding this directly in a lua plugin (by copying the default postgres plugin and adding require "auth/auth_commons"
-- import shared database query logic
require "auth/postgres_cockroach_commons"
function auth_on_register(reg)
return auth_on_register_common(postgres, reg)
end
pool = "auth_postgres"
config = {
pool_id = pool,
size = 1
}
postgres.ensure_pool(config) This also does not change the behaviour. One interesting effect I saw though is, that my plugin is now run 10 times. I have a log statement at top which normally has been printed only once but now 10 times. Not sure if that connected to the issue. Is there any known workaround or do you have any idea how I can investigate this further? |
Looks like the 10 comes from here: https://github.com/vernemq/vernemq/blob/master/apps/vmq_diversity/src/vmq_diversity_sup.erl#L77 I can't really read erlang, but it seems that this file is the culprit. |
Technically, it's in the function clause for postgres:
But your totally right. The ProviderConfig there comes in over the Do you want to have a go at it? Can fix it myself, but low prio ;) |
Note to self: we could upgrade to and test |
Did a PR here. Seems to work in my environment, but not sure if this has any unintended side effects. |
Environment
erlang:23-alpine
Expected behaviour
VerneMQ should use the given
vmq_diversity.postgres.pool_size
orDOCKER_VERNEMQ_VMQ_DIVERSITY__POSTGRES__POOL_SIZE
option to limit the database connections to the specified value.Actual behaviour
Upon setting
DOCKER_VERNEMQ_VMQ_DIVERSITY__POSTGRES__POOL_SIZE
to 1, VerneMQ uses 10 connections to the database (which is already weird because I only see 5 everywhere in the code). Verified by runningSELECT * FROM pg_stat_activity
and looking through the result.I suspected the option to be written incorrectly, but
cat /etc/vernemq/vernemq.conf | grep "pool_size"
showsvmq_diversity.postgres.pool_size=1
.Is this not currently supported properly (I did not found documentation on that apart from this in the schema) or is the config wrong?
The text was updated successfully, but these errors were encountered: