<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><br>
      Hmm... then maybe it's the Wildfly issue in Jgroups subsystem.<br>
      <br>
      The startup lifecycle usually works in a way, that if componentA
      is dependent on componentB, then startup should first ensure that
      componentB is started and then componentA is started afterwards.
      The shutdown works in an opposite way, hence componentA must be
      first shutdown and then componentB afterwards.<br>
      <br>
      I suppose that JGroups subsystem should be clever enough that if
      it sees the property "datasource_jndi_name", it should internally
      declare itself to be dependent on "java:/MySQLDS" datasource. This
      should ensure that during shutdown is JGroups channel shutdown
      first and then the datasource is shutdown afterwards. <br>
      <br>
      Could you ask on Wildfly forums for this?<br>
      <br>
      Marek<br>
      <br>
      <br>
      On 11/07/16 09:11, Sarp Kaya wrote:<br>
    </div>
    <blockquote cite="mid:D3A9833E.B111%25akaya@expedia.com" type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div>Hi Marek,</div>
      <div><br>
      </div>
      <div>The configuration for JDBC_PING is already like this:</div>
      <div><br>
      </div>
      <div>
        <pre style="background-color:#2b2b2b;color:#a9b7c6;font-family:'Menlo';font-size:9.0pt;"><span style="color:#e8bf6a;">&lt;protocol </span><span style="color:#bababa;">type</span><span style="color:#6a8759;">="JDBC_PING"</span><span style="color:#e8bf6a;">&gt;
</span><span style="color:#e8bf6a;">    &lt;property </span><span style="color:#bababa;">name</span><span style="color:#6a8759;">="datasource_jndi_name"</span><span style="color:#e8bf6a;">&gt;</span>java:/MySQLDS<span style="color:#e8bf6a;">&lt;/property&gt;
</span><span style="color:#e8bf6a;">    &lt;property </span><span style="color:#bababa;">name</span><span style="color:#6a8759;">="clear_table_on_view_change"</span><span style="color:#e8bf6a;">&gt;</span>true<span style="color:#e8bf6a;">&lt;/property&gt;
</span><span style="color:#e8bf6a;">&lt;/protocol&gt;</span></pre>
      </div>
      <div><br>
      </div>
      <div>Do you mean something else or is this enough to “declare
        dependency” on MySQLDS?</div>
      <div><br>
      </div>
      <div>Kind Regards,</div>
      <div>Sarp Kaya</div>
      <div><br>
      </div>
      <span id="OLK_SRC_BODY_SECTION">
        <div style="font-family:Calibri; font-size:11pt;
          text-align:left; color:black; BORDER-BOTTOM: medium none;
          BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT:
          0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid;
          BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
          <span style="font-weight:bold">From: </span>Marek Posolda
          &lt;<a moz-do-not-send="true"
            href="mailto:mposolda@redhat.com">mposolda@redhat.com</a>&gt;<br>
          <span style="font-weight:bold">Date: </span>Monday, July 11,
          2016 at 4:54 PM<br>
          <span style="font-weight:bold">To: </span>Abdullah Sarp Kaya
          &lt;<a moz-do-not-send="true" href="mailto:akaya@expedia.com">akaya@expedia.com</a>&gt;,
          "<a moz-do-not-send="true"
            href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>"
          &lt;<a moz-do-not-send="true"
            href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&gt;<br>
          <span style="font-weight:bold">Subject: </span>Re:
          [keycloak-user] JDBC Connection is closed early for Infinispan<br>
        </div>
        <div><br>
        </div>
        <div>
          <div bgcolor="#FFFFFF" text="#000000">
            <div class="moz-cite-prefix">Not sure if this is Wildfly
              issue or Keycloak issue. Maybe it can be handled somehow
              in our subsystem, so you will be able to declare that
              infinispan CacheManager (or JGroups Channel) is dependent
              on datasource "java:/MySQLDS" , which should then ensure
              that infinispan/jgroups will be shoutdown first and then
              the MySQLDS datasource afterwards.<br>
              <br>
              Maybe we can handle our subsystem should be more
              "flexible" and support somehow to easily declare
              dependencies on additional components (maybe it supports
              it already, I don't know...)<br>
              <br>
              Maybe you can create JIRA and investigate this deeper. I
              suggest you investigate by yourself as we probably won't
              have time to look at it. The JGroups channel with
              JDBC_PING is probably not very big priority for us...<br>
              <br>
              Marek<br>
              <br>
              On 11/07/16 02:59, Sarp Kaya wrote:<br>
            </div>
            <blockquote cite="mid:D3A92C8F.B0B5%25akaya@expedia.com"
              type="cite">
              <div>Hello,</div>
              <div><br>
              </div>
              <div>For the caching if we are using infinispan with
                JDBC_PING then JDBC connection is closed before
                infinispan stops its caching related stuff. This causes
                an exception to be thrown and therefore it does not
                really shut infinispan gracefully.</div>
              <div><br>
              </div>
              <div>Logs:</div>
              <div>
                <div>2016-07-11 00:53:48,330 INFO  [org.jboss.as.server]
                  (Thread-2) WFLYSRV0220: Server shutdown has been
                  requested.</div>
                <div>2016-07-11 00:53:48,385 INFO
                   [org.jboss.as.connector.subsystems.datasources] (MSC
                  service thread 1-2) WFLYJCA0010: Unbound data source
                  [java:/MySQLDS]</div>
                <div>2016-07-11 00:53:48,394 INFO
                   [org.infinispan.remoting.transport.jgroups.JGroupsTransport]
                  (MSC service thread 1-2) ISPN000080: Disconnecting
                  JGroups channel web</div>
                <div>2016-07-11 00:53:48,396 INFO
                   [org.infinispan.remoting.transport.jgroups.JGroupsTransport]
                  (MSC service thread 1-1) ISPN000080: Disconnecting
                  JGroups channel server</div>
                <div>2016-07-11 00:53:48,395 INFO
                   [org.wildfly.extension.undertow] (ServerService
                  Thread Pool -- 60) WFLYUT0022: Unregistered web
                  context: /auth</div>
                <div>2016-07-11 00:53:48,397 INFO
                   [org.infinispan.remoting.transport.jgroups.JGroupsTransport]
                  (MSC service thread 1-2) ISPN000082: Stopping the
                  RpcDispatcher for channel web</div>
                <div>2016-07-11 00:53:48,398 INFO
                   [org.infinispan.remoting.transport.jgroups.JGroupsTransport]
                  (MSC service thread 1-1) ISPN000082: Stopping the
                  RpcDispatcher for channel server</div>
                <div>2016-07-11 00:53:48,403 INFO
                   [org.infinispan.remoting.transport.jgroups.JGroupsTransport]
                  (MSC service thread 1-1) ISPN000080: Disconnecting
                  JGroups channel hibernate</div>
                <div>2016-07-11 00:53:48,408 INFO
                   [org.infinispan.remoting.transport.jgroups.JGroupsTransport]
                  (MSC service thread 1-1) ISPN000082: Stopping the
                  RpcDispatcher for channel hibernate</div>
                <div>2016-07-11 00:53:48,407 INFO
                   [org.infinispan.remoting.transport.jgroups.JGroupsTransport]
                  (MSC service thread 1-2) ISPN000080: Disconnecting
                  JGroups channel ejb</div>
                <div>2016-07-11 00:53:48,411 INFO
                   [org.infinispan.remoting.transport.jgroups.JGroupsTransport]
                  (MSC service thread 1-2) ISPN000082: Stopping the
                  RpcDispatcher for channel ejb</div>
                <div>2016-07-11 00:53:48,414 INFO
                   [org.wildfly.extension.undertow] (MSC service thread
                  1-2) WFLYUT0008: Undertow HTTPS listener https
                  suspending</div>
                <div>2016-07-11 00:53:48,416 WARN
                   [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool]
                  (ServerService Thread Pool -- 59) IJ000615: Destroying
                  active connection in pool: MySQLDS
                  (org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@57e067d0)</div>
                <div>2016-07-11 00:53:48,423 INFO
                   [org.wildfly.extension.undertow] (MSC service thread
                  1-2) WFLYUT0007: Undertow HTTPS listener https
                  stopped, was bound to 0.0.0.0:8443</div>
                <div>2016-07-11 00:53:48,429 INFO
                   [org.jboss.as.connector.deployers.jdbc] (MSC service
                  thread 1-1) WFLYJCA0019: Stopped Driver service with
                  driver-name = mysql</div>
                <div>2016-07-11 00:53:48,434 INFO
                   [org.wildfly.extension.undertow] (MSC service thread
                  1-1) WFLYUT0019: Host default-host stopping</div>
                <div>2016-07-11 00:53:48,448 INFO
                   [org.jboss.as.connector.subsystems.datasources] (MSC
                  service thread 1-1) WFLYJCA0010: Unbound data source
                  [java:jboss/datasources/ExampleDS]</div>
                <div>2016-07-11 00:53:48,467 INFO
                   [org.jboss.as.clustering.infinispan] (ServerService
                  Thread Pool -- 59) WFLYCLINF0003: Stopped sessions
                  cache from keycloak container</div>
                <div>2016-07-11 00:53:48,472 INFO
                   [org.jboss.as.clustering.infinispan] (ServerService
                  Thread Pool -- 60) WFLYCLINF0003: Stopped realms cache
                  from keycloak container</div>
                <div>2016-07-11 00:53:48,475 INFO
                   [org.jboss.as.clustering.infinispan] (ServerService
                  Thread Pool -- 60) WFLYCLINF0003: Stopped
                  loginFailures cache from keycloak container</div>
                <div>2016-07-11 00:53:48,477 INFO
                   [org.jboss.as.clustering.infinispan] (ServerService
                  Thread Pool -- 59) WFLYCLINF0003: Stopped
                  offlineSessions cache from keycloak container</div>
                <div>2016-07-11 00:53:48,487 INFO
                   [org.jboss.as.connector.deployers.jdbc] (MSC service
                  thread 1-1) WFLYJCA0019: Stopped Driver service with
                  driver-name = h2</div>
                <div>2016-07-11 00:53:48,489 INFO
                   [org.jboss.as.clustering.infinispan] (ServerService
                  Thread Pool -- 63) WFLYCLINF0003: Stopped users cache
                  from keycloak container</div>
                <div>2016-07-11 00:53:48,492 INFO
                   [org.wildfly.extension.undertow] (MSC service thread
                  1-2) WFLYUT0008: Undertow AJP listener ajp suspending</div>
                <div>2016-07-11 00:53:48,496 INFO
                   [org.jboss.as.clustering.infinispan] (ServerService
                  Thread Pool -- 62) WFLYCLINF0003: Stopped
                  realmVersions cache from keycloak container</div>
                <div>2016-07-11 00:53:48,497 INFO
                   [org.wildfly.extension.undertow] (MSC service thread
                  1-2) WFLYUT0007: Undertow AJP listener ajp stopped,
                  was bound to 0.0.0.0:8009</div>
                <div>2016-07-11 00:53:48,500 INFO
                   [org.jboss.as.clustering.infinispan] (ServerService
                  Thread Pool -- 64) WFLYCLINF0003: Stopped work cache
                  from keycloak container</div>
                <div>2016-07-11 00:53:48,499 INFO
                   [org.jboss.modcluster] (ServerService Thread Pool --
                  65) MODCLUSTER000002: Initiating mod_cluster shutdown</div>
                <div>2016-07-11 00:53:48,506 INFO
                   [org.jboss.as.server.deployment] (MSC service thread
                  1-2) WFLYSRV0028: Stopped deployment
                  keycloak-server.war (runtime-name:
                  keycloak-server.war) in 138ms</div>
                <div>2016-07-11 00:53:48,499 INFO
                   [org.wildfly.extension.undertow] (MSC service thread
                  1-1) WFLYUT0008: Undertow HTTP listener default
                  suspending</div>
                <div>2016-07-11 00:53:48,508 INFO
                   [org.wildfly.extension.undertow] (MSC service thread
                  1-1) WFLYUT0007: Undertow HTTP listener default
                  stopped, was bound to 0.0.0.0:8080</div>
                <div>2016-07-11 00:53:48,516 INFO
                   [org.jboss.as.clustering.infinispan] (MSC service
                  thread 1-2) WFLYCLINF0003: Stopped authorization cache
                  from keycloak container</div>
                <div>2016-07-11 00:53:48,517 INFO
                   [org.wildfly.extension.undertow] (MSC service thread
                  1-1) WFLYUT0004: Undertow 1.3.15.Final stopping</div>
                <div>2016-07-11 00:53:48,542 INFO
                   [org.infinispan.remoting.transport.jgroups.JGroupsTransport]
                  (MSC service thread 1-2) ISPN000080: Disconnecting
                  JGroups channel keycloak</div>
                <div>2016-07-11 00:53:48,543 INFO
                   [org.infinispan.remoting.transport.jgroups.JGroupsTransport]
                  (MSC service thread 1-2) ISPN000082: Stopping the
                  RpcDispatcher for channel keycloak</div>
                <div>2016-07-11 00:53:48,553 ERROR
                  [org.jgroups.protocols.JDBC_PING] (MSC service thread
                  1-1) 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:/MySQLDS</div>
                <div>        at
org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:146)</div>
                <div>        at
org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:66)</div>
                <div>        at
                  org.jgroups.protocols.JDBC_PING.getConnection(JDBC_PING.java:348)</div>
                <div>        at
                  org.jgroups.protocols.JDBC_PING.delete(JDBC_PING.java:379)</div>
                <div>        at
                  org.jgroups.protocols.JDBC_PING.deleteSelf(JDBC_PING.java:395)</div>
                <div>        at
                  org.jgroups.protocols.JDBC_PING.stop(JDBC_PING.java:144)</div>
                <div>        at
                  org.jgroups.stack.ProtocolStack.stopStack(ProtocolStack.java:1015)</div>
                <div>        at
                  org.jgroups.JChannel.stopStack(JChannel.java:1002)</div>
                <div>        at
                  org.jgroups.JChannel.disconnect(JChannel.java:373)</div>
                <div>        at
org.wildfly.clustering.jgroups.spi.service.ChannelConnectorBuilder.stop(ChannelConnectorBuilder.java:103)</div>
                <div>        at
org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:2056)</div>
                <div>        at
org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:2017)</div>
                <div>        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)</div>
                <div>        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)</div>
                <div>        at java.lang.Thread.run(Thread.java:745)</div>
                <div>Caused by: javax.resource.ResourceException:
                  IJ000470: You are trying to use a connection factory
                  that has been shut down: java:/MySQLDS</div>
                <div>        at
org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:735)</div>
                <div>        at
org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)</div>
                <div>        ... 14 more</div>
                <div><br>
                </div>
                <div>2016-07-11 00:53:48,559 ERROR
                  [org.jgroups.protocols.JDBC_PING] (MSC service thread
                  1-1) Failed to delete PingData in database</div>
                <div>2016-07-11 00:53:51,576 INFO  [org.jboss.as] (MSC
                  service thread 1-1) WFLYSRV0050: Keycloak 2.0.0.Final
                  (WildFly Core 2.0.10.Final) stopped in 3208ms</div>
              </div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div>Kind Regards,</div>
              <div>Sarp Kaya</div>
              <br>
              <fieldset class="mimeAttachmentHeader"></fieldset>
              <br>
              <pre wrap="">_______________________________________________
keycloak-user mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/keycloak-user">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
            </blockquote>
            <br>
          </div>
        </div>
      </span>
    </blockquote>
    <br>
  </body>
</html>