"Expired_Code" error in keycloak HA 26.0.1 with distributed cache enabled

Hi dasniko,

The ports are configured like this on Azure:

I checked the logs of all 3 containers and I saw that all seems work correctly (sync is ok, etc)

About the cluster setup you mean the env vars I setted? These are the environment vars related to the cache.

KC_CACHE=ispn
KC_CACHE_METRICS_HISTOGRAMS_ENABLED=true
KC_CACHE_CONFIG_FILE=cache-ispn.xml

The “cache-ispn.xml” content is the following (the latest version):

<jgroups>
  <stack name="jdbc-ping" extends="tcp">
    <JDBC_PING connection_driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
			   connection_username="xxxxxxxxxxx" 
			   connection_password="xxxxxxxxxxx"
               connection_url="jdbc:sqlserver://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
               initialize_sql="IF NOT EXISTS (SELECT * FROM sysobjects WHERE name='JGROUPSPING' AND xtype='U') BEGIN CREATE TABLE JGROUPSPING (own_addr VARCHAR(200) NOT NULL, cluster_name VARCHAR(200) NOT NULL, ping_data VARBINARY(MAX), CONSTRAINT PK_JGROUPSPING PRIMARY KEY (own_addr, cluster_name));END;" 	 			   
               info_writer_sleep_time="500"
               remove_all_data_on_view_change="true"				   
               stack.combine="REPLACE"
               stack.position="MPING" />
  </stack>
</jgroups>
<cache-container name="keycloak">
        <transport lock-timeout="60000" stack="jdbc-ping"/>
		
        <local-cache name="realms" simple-cache="true">
            <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" simple-cache="true">
            <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="authorization" simple-cache="true">
            <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="keys" simple-cache="true">
            <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="sessions" owners="3">
            <expiration lifespan="43200000" max-idle="50400000"/>
        </distributed-cache>
        <distributed-cache name="authenticationSessions" owners="3">
            <expiration lifespan="120000"/>
        </distributed-cache>
        <distributed-cache name="offlineSessions" owners="3">
            <expiration lifespan="86400000"/>
        </distributed-cache>
        <distributed-cache name="clientSessions" owners="3">
            <expiration lifespan="3600000"/>
        </distributed-cache>
        <distributed-cache name="offlineClientSessions" owners="3">
            <expiration lifespan="86400000"/>
        </distributed-cache>
        <distributed-cache name="loginFailures" owners="3">
            <expiration lifespan="86400000" max-idle="3600000" interval="60000"/> 
        </distributed-cache>                      
        <distributed-cache name="actionTokens" owners="3">
            <encoding>
                <key media-type="application/x-java-object"/>
                <value media-type="application/x-java-object"/>
            </encoding>            
			<expiration lifespan="1800000" max-idle="1800000" interval="120000"/> 		
            <memory max-count="10000" when-full="REMOVE"/>
        </distributed-cache>
		
		<replicated-cache name="work">
            <expiration lifespan="86400000"/>
			<memory max-count="10000" when-full="REMOVE"/>
        </replicated-cache>
		
    </cache-container>

Thanks in advance,
Enrico