Use JDBC_PING with Keycloak 17+ results in timeout

I followed this great discussion : Use of JDBC_PING with Keycloak 17 (Quarkus distro) about connecting multiple instances of Keycloak.

In my case it’s a docker stack deploy using gist files provided by @xgp

Everything runs smoothly the first time I launch the stack however when killing/restarting an instance to test my load balancer for example, the freshly created instance doesn’t connect due to a timeout when trying to join jdbc_ping cluster:

2023-11-27 19:40:38,687 INFO [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: Base URL: , Hostname: , Strict HTTPS: false, Path: , Strict BackChannel: false, Admin URL: , Admin: , Port: -1, Proxied: false
2023-11-27 19:40:40,342 WARN [io.quarkus.agroal.runtime.DataSources] (main) Datasource enables XA but transaction recovery is not enabled. Please enable transaction recovery by setting quarkus.transaction-manager.enable-recovery=true, otherwise data may be lost if the application is terminated abruptly
2023-11-27 19:40:41,017 WARN [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2023-11-27 19:40:41,140 INFO [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller ‘org.infinispan.jboss.marshalling.core.JBossUserMarshaller’
2023-11-27 19:40:41,362 INFO [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000078: Starting JGroups channel ISPN with stack jdbc-ping-tcp
2023-11-27 19:40:41,365 INFO [org.jgroups.JChannel] (keycloak-cache-init) local_addr: 0650c86a-7bff-4d5d-b614-54dfc1158aa9, name: f6c429a294d6-26308
2023-11-27 19:40:41,375 INFO [org.jgroups.protocols.FD_SOCK2] (keycloak-cache-init) server listening on *.57800
2023-11-27 19:40:43,408 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to b723ab3f5043-24600 timed out (after 2000 ms), on try 0
2023-11-27 19:40:45,409 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to 4dd272b60acf-6201 timed out (after 2000 ms), on try 0
2023-11-27 19:40:47,421 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to 4dd272b60acf-6201 timed out (after 2000 ms), on try 1
2023-11-27 19:40:49,421 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to b723ab3f5043-24600 timed out (after 2000 ms), on try 1
2023-11-27 19:40:51,433 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to b723ab3f5043-24600 timed out (after 2000 ms), on try 2
2023-11-27 19:40:53,434 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to 4dd272b60acf-6201 timed out (after 2000 ms), on try 2
2023-11-27 19:40:55,449 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to 4dd272b60acf-6201 timed out (after 2000 ms), on try 3
2023-11-27 19:40:57,449 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to b723ab3f5043-24600 timed out (after 2000 ms), on try 3
2023-11-27 19:40:59,460 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to b723ab3f5043-24600 timed out (after 2000 ms), on try 4
2023-11-27 19:41:01,461 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to 4dd272b60acf-6201 timed out (after 2000 ms), on try 4
2023-11-27 19:41:03,473 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to b723ab3f5043-24600 timed out (after 2000 ms), on try 5
2023-11-27 19:41:05,473 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to 4dd272b60acf-6201 timed out (after 2000 ms), on try 5
2023-11-27 19:41:07,490 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to 4dd272b60acf-6201 timed out (after 2000 ms), on try 6
2023-11-27 19:41:09,490 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to b723ab3f5043-24600 timed out (after 2000 ms), on try 6
2023-11-27 19:41:11,501 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to b723ab3f5043-24600 timed out (after 2000 ms), on try 7
2023-11-27 19:41:13,502 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to 4dd272b60acf-6201 timed out (after 2000 ms), on try 7
2023-11-27 19:41:15,581 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to 4dd272b60acf-6201 timed out (after 2000 ms), on try 8
2023-11-27 19:41:17,581 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to b723ab3f5043-24600 timed out (after 2000 ms), on try 8
2023-11-27 19:41:19,593 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to b723ab3f5043-24600 timed out (after 2000 ms), on try 9
2023-11-27 19:41:21,593 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: JOIN(f6c429a294d6-26308) sent to 4dd272b60acf-6201 timed out (after 2000 ms), on try 9
2023-11-27 19:41:21,593 WARN [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) f6c429a294d6-26308: too many JOIN attempts (10): becoming singleton
2023-11-27 19:41:21,832 INFO [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000094: Received new cluster view for channel ISPN: [f6c429a294d6-26308|0] (1) [f6c429a294d6-26308]
2023-11-27 19:41:21,880 INFO [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000079: Channel ISPN local address is f6c429a294d6-26308, physical addresses are [172.18.0.20:7800]
2023-11-27 19:41:22,205 INFO [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (main) Node name: f6c429a294d6-26308, Site name: null
2023-11-27 19:41:22,535 INFO [org.keycloak.broker.provider.AbstractIdentityProviderMapper] (main) Registering class org.keycloak.broker.provider.mappersync.ConfigSyncEventListener
2023-11-27 19:41:23,435 INFO [io.quarkus] (main) Keycloak 22.0.0 on JVM (powered by Quarkus 3.2.0.Final) started in 45.905s. Listening on: http://0.0.0.0:8080 and https://0.0.0.0:8443

I can recopy files here if you want but there are barely the same (added missing insert,delete,select in cache-ispn).

Any advice on how to fix?

Got any luck with that, i have pretty much the same problem? I am using docker run on ec2 instances in private subnets and want to form a cluster for caching.

Hello everyone,
I am experiencing the same issue , is there any solution for this thank you
Best regards