Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-12948

When shutting down, JDBC_PING tries to use a closed connection

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Rejected
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Clustering
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      1. Download keycloak-mariadb-jdbc-ping.yml
      2. Use docker-compose -f keycloak-mariadb-jdbc-ping.yml up to start both MariaDB and Keycloak.
      3. Scale Keycloak up using docker-compose -f keycloak-mariadb-jdbc-ping.yml scale keycloak=2. Note, that both Keycloak nodes form a cluster.
      4. Scale Keycloak down to 0 using docker-compose -f keycloak-mariadb-jdbc-ping.yml scale keycloak=0
      5. Observe errors in logs.

      Show
      1. Download keycloak-mariadb-jdbc-ping.yml 2. Use docker-compose -f keycloak-mariadb-jdbc-ping.yml up to start both MariaDB and Keycloak. 3. Scale Keycloak up using docker-compose -f keycloak-mariadb-jdbc-ping.yml scale keycloak=2 . Note, that both Keycloak nodes form a cluster. 4. Scale Keycloak down to 0 using docker-compose -f keycloak-mariadb-jdbc-ping.yml scale keycloak=0 5. Observe errors in logs.

      Description

      One of the Keycloak demos use JDBC_PING as discovery protocol (see here). One of our users noticed (and I confirmed it) that when shutting Keycloak down, JDBC_PING tries to use a closed Connection Factory:

      keycloak_2  | 09:14:34,807 ERROR [org.jgroups.protocols.JDBC_PING] (ServerService Thread Pool -- 23) JGRP000115: Could not open connection to database: java.sql.SQLException: javax.resource.ResourceException: IJ000470: You are trying to use a connection factory that has been shut down: java:jboss/datasources/KeycloakDS
      keycloak_2  | 	at org.jboss.ironjacamar.jdbcadapters@1.4.17.Final//org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:159)
      keycloak_2  | 	at org.jboss.as.connector@18.0.1.Final//org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:64)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.protocols.JDBC_PING.getConnection(JDBC_PING.java:310)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.protocols.JDBC_PING.clearTable(JDBC_PING.java:361)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.protocols.JDBC_PING.removeAll(JDBC_PING.java:190)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.protocols.JDBC_PING.stop(JDBC_PING.java:119)
      keycloak_2  | 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.stack.ProtocolStack.stopStack(ProtocolStack.java:906)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.JChannel.stopStack(JChannel.java:1076)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.JChannel._close(JChannel.java:1063)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.JChannel.close(JChannel.java:454)
      keycloak_2  | 	at org.jboss.as.clustering.jgroups@18.0.1.Final//org.jboss.as.clustering.jgroups.subsystem.ChannelServiceConfigurator.accept(ChannelServiceConfigurator.java:132)
      keycloak_2  | 	at org.jboss.as.clustering.jgroups@18.0.1.Final//org.jboss.as.clustering.jgroups.subsystem.ChannelServiceConfigurator.accept(ChannelServiceConfigurator.java:58)
      keycloak_2  | 	at org.wildfly.clustering.service@18.0.1.Final//org.wildfly.clustering.service.FunctionalService.stop(FunctionalService.java:77)
      keycloak_2  | 	at org.wildfly.clustering.service@18.0.1.Final//org.wildfly.clustering.service.AsyncServiceConfigurator$AsyncService.lambda$stop$1(AsyncServiceConfigurator.java:142)
      keycloak_2  | 	at org.jboss.threads@2.3.3.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      keycloak_2  | 	at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
      keycloak_2  | 	at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      keycloak_2  | 	at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      keycloak_2  | 	at java.base/java.lang.Thread.run(Thread.java:834)
      keycloak_2  | 	at org.jboss.threads@2.3.3.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)
      keycloak_2  | Caused by: javax.resource.ResourceException: IJ000470: You are trying to use a connection factory that has been shut down: java:jboss/datasources/KeycloakDS
      keycloak_2  | 	at org.jboss.ironjacamar.impl@1.4.17.Final//org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:777)
      keycloak_2  | 	at org.jboss.ironjacamar.jdbcadapters@1.4.17.Final//org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:151)
      keycloak_2  | 	... 20 more
      keycloak_2  | 09:14:34,807 ERROR [org.jgroups.JChannel] (ServerService Thread Pool -- 23) JGRP000020: failed destroying the protocol stack: java.lang.NullPointerException
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.protocols.JDBC_PING.clearTable(JDBC_PING.java:362)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.protocols.JDBC_PING.removeAll(JDBC_PING.java:190)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.protocols.JDBC_PING.stop(JDBC_PING.java:119)
      keycloak_2  | 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.stack.ProtocolStack.stopStack(ProtocolStack.java:906)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.JChannel.stopStack(JChannel.java:1076)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.JChannel._close(JChannel.java:1063)
      keycloak_2  | 	at org.jgroups@4.1.4.Final//org.jgroups.JChannel.close(JChannel.java:454)
      keycloak_2  | 	at org.jboss.as.clustering.jgroups@18.0.1.Final//org.jboss.as.clustering.jgroups.subsystem.ChannelServiceConfigurator.accept(ChannelServiceConfigurator.java:132)
      keycloak_2  | 	at org.jboss.as.clustering.jgroups@18.0.1.Final//org.jboss.as.clustering.jgroups.subsystem.ChannelServiceConfigurator.accept(ChannelServiceConfigurator.java:58)
      keycloak_2  | 	at org.wildfly.clustering.service@18.0.1.Final//org.wildfly.clustering.service.FunctionalService.stop(FunctionalService.java:77)
      keycloak_2  | 	at org.wildfly.clustering.service@18.0.1.Final//org.wildfly.clustering.service.AsyncServiceConfigurator$AsyncService.lambda$stop$1(AsyncServiceConfigurator.java:142)
      keycloak_2  | 	at org.jboss.threads@2.3.3.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      keycloak_2  | 	at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
      keycloak_2  | 	at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      keycloak_2  | 	at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      keycloak_2  | 	at java.base/java.lang.Thread.run(Thread.java:834)
      keycloak_2  | 	at org.jboss.threads@2.3.3.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)
      keycloak_2  | 09:14:34,819 INFO  [org.jboss.as] (MSC service thread 1-5) WFLYSRV0050: Keycloak 8.0.1 (WildFly Core 10.0.3.Final) stopped in 160ms
      keycloak_2  | *** JBossAS process (510) received TERM signal ***
      

      More information:

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  rhusar Radoslav Husar
                  Reporter:
                  sebastian.laskawiec Sebastian Laskawiec
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: