Keycloak db connection pool not gracefully surviving database server restart

Hi,

We recently experienced an outage on our Keycloak server. Sever OS packages updated overnight, which restarted our postgres server service, and even though the downtime of the database was very short, Keycloak was showing a “white screen of death” several hours later when we all woke up.

The only thing that would fix it was to restart Keycloak. Is there a better way to have Keycloak recover from having its database restarted? I haven’t seen and JDBC settings that can “prune” dead connections in the connection pool.

A stacktrace is here: https://gitlab.umiacs.umd.edu/snippets/30

Thanks,
Liam