2

I deploy Keycloak server app (based on WildFly 10.0.0.Final) to Pivotal Cloud Foundry and use ClearDB service as relational database.

ClearDB has a restriction, that it closes all connections, that are idle for 90 seconds.

To not run into the situation, when Keycloak tries to use closed connection, I've added following datasource configuration (based on Pivotal recommendations):

<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
    <connection-url>jdbc:mysql://blah.cleardb.net/blah?user=blah&password=blah</connection-url>
    <driver>mysql</driver>
    <pool>
        <min-pool-size>1</min-pool-size>
        <max-pool-size>10</max-pool-size>
    </pool>
    <timeout>
        <idle-timeout-minutes>1</idle-timeout-minutes>
    </timeout>
    <validation>
        <validate-on-match>true</validate-on-match>
        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
        <exception-sorter  class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
    </validation>
</datasource>

But even after applying this configuration I see in the ClearDB management console that idle connections are closed only after 90 seconds and not after 60 seconds (1 minute) as it's specified with "idle-timeout-minutes" parameter.

I've already talked to Keycloak guys in their mailing list, they suggested to try solution from this stackoverflow question, but it didn't help. Also they said, that it didn't look like Keycloak issue, but Wildfly one.

So, have anybody of you faced similar situation? Or maybe you have some ideas why these idle connections are not being closed.

Thanks!

Kir Merzlikin
  • 101
  • 1
  • 5
  • Was the pool completely idle, not having a single connection being used, within that 1 minute? – Quincy Aug 01 '17 at 02:04
  • @Quincy I think so. ClearDB management console and "SHOW FULL PROCESSLIST" query showed that all open connections were IDLE. – Kir Merzlikin Aug 01 '17 at 07:42

0 Answers0