Keycloak.X - number of database connections growing quickly until the DB server limit is hit

Hi there,

I’m playing around with Keycloak.X (Preview) on my local machine using postgresql (13) as database.

Starting and running the server seems to be quite simple but when I log in to the admin console and click around a little bit, e.g. quickly navigating between “Clients” and “Roles” the number of database connections increases quickly. Eventually it hits the DB server limit (around 100 according the the postgresql server settings) and then errors popup in keycloak.

This is a screenshot from pgadmin:

It seems to release idle connections sporadically/randomly. Eventually it does not prevent that the DB server connection limit is reached which results in errors.

I also tried to limit the number of max connections using --db.pool.max-size and then -Dquarkus.datasource.jdbc.max-size but both do not seem to have any effect.

Any idea what I’m doing wrong?

Kind regards,

Hi, are you ussing this configuration as environment variables in docker?


I tried both as command line option ( --db.pool.max-size and -Dquarkus.datasource.jdbc.max-size) as well as environment variables KC_DB_POOL_MAX-SIZE and KC_DB_POOL_MAX_SIZE. Without any noticable effect.

Besides the point that I cannot get the --db.pool.max-size parameter to work it still seems very odd that the number of idle DB connections sky-rockets to those heights for me being the only user logged in by just clicking around in the admin console. The wildfly version does not show this behavior.

So, any help appreciated here.