jGroups/Infinispan Bedevilling: No DB Table Created (Unable to persist Infinispan internal caches as no global state enabled)

@xgp Thank you!

The Keycloak v18.0.1 runs on AWS EC2 Linux (no containers); load balanced on ALB (running on 1 node pending figuring out clustering).

Please find the build, start, cache-ispn-jdbc-ping.xml, logs (INFO; with TRACE for org.jgroups.protocols). The DB Vendor is ‘oracle’.

Very much appreciate your and @dasniko’s help.

Thanks.

1- Build

export KC_BUILD_OPTS="$KC_BUILD_OPTS --db=${KEYCLOAK_DB_VENDOR}"
export KC_BUILD_OPTS="$KC_START_OPTS --http-relative-path=/auth/"
export KC_BUILD_OPTS="$KC_BUILD_OPTS --cache-stack=tcp"
export KC_BUILD_OPTS="$KC_BUILD_OPTS --cache-config-file=cache-ispn-jdbc-ping.xml"

2 - Start

export KC_START_OPTS="$KC_START_OPTS --proxy=edge"
export KC_START_OPTS="$KC_START_OPTS --hostname-strict=false"
export KC_START_OPTS="$KC_START_OPTS --log=console,file"
export KC_START_OPTS="$KC_START_OPTS --log-level=INFO,org.jgroups.protocols:TRACE"
export KC_START_OPTS="$KC_START_OPTS --log-file=/var/log/keycloak/keycloak.log"

3- cache-ispn-jdbc-ping.xml


<?xml version="1.0" encoding="UTF-8"?>
<infinispan
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:infinispan:config:11.0 http://www.infinispan.org/schemas/infinispan-config-11.0.xsd"
    xmlns="urn:infinispan:config:11.0">

  <!-- custom stack goes into the jgroups element -->
  <jgroups>
    <stack name="jdbc-ping-tcp" extends="tcp">
      <JDBC_PING connection_driver="oracle.jdbc.driver.OracleDriver"
                 connection_username="${env.KC_DB_USERNAME}" 
                 connection_password="${env.KC_DB_PASSWORD}" 
                 connection_url="${env.KC_DB_URL}" 
                 info_writer_sleep_time="500"
                 stack.combine="REPLACE"
                 stack.position="MPING" />
    </stack>
  </jgroups>
  
  <cache-container name="keycloak">
    <!-- custom stack must be referenced by name in the stack attribute of the transport element -->
    <transport lock-timeout="60000" stack="jdbc-ping-tcp"/>
    <local-cache name="realms">
      <encoding>
        <key media-type="application/x-java-object"/>
        <value media-type="application/x-java-object"/>
      </encoding>
      <memory max-count="10000"/>
    </local-cache>
    <local-cache name="users">
      <encoding>
        <key media-type="application/x-java-object"/>
        <value media-type="application/x-java-object"/>
      </encoding>
      <memory max-count="10000"/>
    </local-cache>
    <distributed-cache name="sessions" owners="2">
      <expiration lifespan="-1"/>
    </distributed-cache>
    <distributed-cache name="authenticationSessions" owners="2">
      <expiration lifespan="-1"/>
    </distributed-cache>
    <distributed-cache name="offlineSessions" owners="2">
      <expiration lifespan="-1"/>
    </distributed-cache>
    <distributed-cache name="clientSessions" owners="2">
      <expiration lifespan="-1"/>
    </distributed-cache>
    <distributed-cache name="offlineClientSessions" owners="2">
      <expiration lifespan="-1"/>
    </distributed-cache>
    <distributed-cache name="loginFailures" owners="2">
      <expiration lifespan="-1"/>
    </distributed-cache>
    <local-cache name="authorization">
      <encoding>
        <key media-type="application/x-java-object"/>
        <value media-type="application/x-java-object"/>
      </encoding>
      <memory max-count="10000"/>
    </local-cache>
    <replicated-cache name="work">
      <expiration lifespan="-1"/>
    </replicated-cache>
    <local-cache name="keys">
      <encoding>
        <key media-type="application/x-java-object"/>
        <value media-type="application/x-java-object"/>
      </encoding>
      <expiration max-idle="3600000"/>
      <memory max-count="1000"/>
    </local-cache>
    <distributed-cache name="actionTokens" owners="2">
      <encoding>
        <key media-type="application/x-java-object"/>
        <value media-type="application/x-java-object"/>
      </encoding>
      <expiration max-idle="-1" lifespan="-1" interval="300000"/>
      <memory max-count="-1"/>
    </distributed-cache>
  </cache-container>
</infinispan>

4 - LOGS


022-07-05 10:17:57,005 INFO  [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: FrontEnd: foobar.com, Strict HTTPS: true, Path: <request>, Strict BackChannel: false, Admin: <request>, Port: -1, Proxied: true
2022-07-05 10:18:01,018 WARN  [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2022-07-05 10:18:01,056 WARN  [org.infinispan.CONFIG] (keycloak-cache-init) ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
2022-07-05 10:18:01,112 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'
2022-07-05 10:18:01,960 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000128: Infinispan version: Infinispan 'Triskaidekaphobia' 13.0.9.Final
2022-07-05 10:18:02,222 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000078: Starting JGroups channel `ISPN` with stack `jdbc-ping-tcp`
2022-07-05 10:18:02,411 DEBUG [org.jgroups.protocols.TCP] (keycloak-cache-init) thread pool min/max/keep-alive: 0/200/60000 use_fork_join=false, internal pool: 0/4/30000 (2 cores available)
2022-07-05 10:18:02,417 DEBUG [org.jgroups.protocols.MPING] (keycloak-cache-init) bind_addr=/10.57.226.71, mcast_addr=/228.6.7.8, mcast_port=46655
2022-07-05 10:18:02,427 TRACE [org.jgroups.protocols.pbcast.NAKACK2] (keycloak-cache-init) null: set max_xmit_req_size from 0 to 511600
2022-07-05 10:18:02,428 TRACE [org.jgroups.protocols.UNICAST3] (keycloak-cache-init) null: set max_xmit_req_size from 0 to 511600
2022-07-05 10:18:02,479 DEBUG [org.jgroups.protocols.MPING] (keycloak-cache-init) receiver thread started
2022-07-05 10:18:02,486 TRACE [org.jgroups.protocols.pbcast.STABLE] (keycloak-cache-init) ip-10-57-226-71-22387: stable task started
2022-07-05 10:18:02,487 DEBUG [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) address=ip-10-57-226-71-22387, cluster=ISPN, physical address=10.57.226.71:7800
2022-07-05 10:18:04,501 INFO  [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) ip-10-57-226-71-22387: no members discovered after 2002 ms: creating cluster as coordinator
2022-07-05 10:18:04,503 DEBUG [org.jgroups.protocols.pbcast.NAKACK2] (keycloak-cache-init)
[ip-10-57-226-71-22387 setDigest()]
existing digest:  []
new digest:       ip-10-57-226-71-22387: [0 (0)]
resulting digest: ip-10-57-226-71-22387: [0 (0)]
2022-07-05 10:18:04,503 DEBUG [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) ip-10-57-226-71-22387: installing view [ip-10-57-226-71-22387|0] (1) [ip-10-57-226-71-22387] (ip-10-57-226-71-22387 joined)
2022-07-05 10:18:04,505 DEBUG [org.jgroups.protocols.pbcast.STABLE] (keycloak-cache-init) resuming message garbage collection
2022-07-05 10:18:04,510 TRACE [org.jgroups.protocols.UFC] (keycloak-cache-init) new membership: [ip-10-57-226-71-22387]
2022-07-05 10:18:04,511 TRACE [org.jgroups.protocols.MFC] (keycloak-cache-init) new membership: [ip-10-57-226-71-22387]
2022-07-05 10:18:04,513 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000094: Received new cluster view for channel ISPN: [ip-10-57-226-71-22387|0] (1) [ip-10-57-226-71-22387]
2022-07-05 10:18:04,517 DEBUG [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) ip-10-57-226-71-22387: created cluster (first member). My view is [ip-10-57-226-71-22387|0], impl is CoordGmsImpl
2022-07-05 10:18:04,518 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000079: Channel `ISPN` local address is `ip-10-57-226-71-22387`, physical addresses are `[10.57.226.71:7800]`
2022-07-05 10:18:04,996 TRACE [org.jgroups.protocols.pbcast.NAKACK2] (non-blocking-thread--p2-t1) ip-10-57-226-71-22387 --> [all]: #1
2022-07-05 10:18:05,001 TRACE [org.jgroups.protocols.TCP] (non-blocking-thread--p2-t1) ip-10-57-226-71-22387: sending msg to null, src=ip-10-57-226-71-22387, size=2219, headers are NAKACK2: [MSG, seqno=1], TP: [cluster=ISPN]
2022-07-05 10:18:05,005 TRACE [org.jgroups.protocols.MFC] (non-blocking-thread--p2-t1) ip-10-57-226-71-22387 used 2176 credits, 3997824 remaining
2022-07-05 10:18:05,071 TRACE [org.jgroups.protocols.pbcast.NAKACK2] (non-blocking-thread--p2-t4) ip-10-57-226-71-22387 --> [all]: #2
2022-07-05 10:18:05,072 TRACE [org.jgroups.protocols.TCP] (non-blocking-thread--p2-t4) ip-10-57-226-71-22387: sending msg to null, src=ip-10-57-226-71-22387, size=2205, headers are NAKACK2: [MSG, seqno=2], TP: [cluster=ISPN]
2022-07-05 10:18:05,072 TRACE [org.jgroups.protocols.MFC] (non-blocking-thread--p2-t4) ip-10-57-226-71-22387 used 2162 credits, 3995662 remaining
2022-07-05 10:18:05,085 TRACE [org.jgroups.protocols.pbcast.NAKACK2] (non-blocking-thread--p2-t3) ip-10-57-226-71-22387 --> [all]: #3
2022-07-05 10:18:05,086 TRACE [org.jgroups.protocols.TCP] (non-blocking-thread--p2-t3) ip-10-57-226-71-22387: sending msg to null, src=ip-10-57-226-71-22387, size=2211, headers are NAKACK2: [MSG, seqno=3], TP: [cluster=ISPN]
2022-07-05 10:18:05,086 TRACE [org.jgroups.protocols.MFC] (non-blocking-thread--p2-t3) ip-10-57-226-71-22387 used 2168 credits, 3993494 remaining
2022-07-05 10:18:05,106 TRACE [org.jgroups.protocols.pbcast.NAKACK2] (non-blocking-thread--p2-t2) ip-10-57-226-71-22387 --> [all]: #4
2022-07-05 10:18:05,107 TRACE [org.jgroups.protocols.TCP] (non-blocking-thread--p2-t2) ip-10-57-226-71-22387: sending msg to null, src=ip-10-57-226-71-22387, size=1180, headers are NAKACK2: [MSG, seqno=4], TP: [cluster=ISPN]
2022-07-05 10:18:05,107 TRACE [org.jgroups.protocols.MFC] (non-blocking-thread--p2-t2) ip-10-57-226-71-22387 used 1137 credits, 3992357 remaining
2022-07-05 10:18:05,118 TRACE [org.jgroups.protocols.pbcast.NAKACK2] (non-blocking-thread--p2-t1) ip-10-57-226-71-22387 --> [all]: #5
2022-07-05 10:18:05,118 TRACE [org.jgroups.protocols.TCP] (non-blocking-thread--p2-t1) ip-10-57-226-71-22387: sending msg to null, src=ip-10-57-226-71-22387, size=1213, headers are NAKACK