Search code examples
jbosssingletonwildflywildfly-clusterwildfly-16

Wildfly : Singleton Deployment on Cluster | Elects two servers in Server Group


This does not happens all time but many a times.

  • 3 Clusters of Server Group
  • Wildfly 16

Deploy .war from UI. It picks fine on one server::

2020-02-26 07:21:12,951 INFO  [org.wildfly.clustering.server] (LegacyDistributedSingletonService - 1) WFLYCLSV0003: alp-esb-app02:servicedesk-02 elected as the singleton provider of the jboss.deployment.unit."Now-1.11-SNAPSHOT.war".installer service
2020-02-26 07:21:13,115 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 26) WFLYSRV0010: Deployed "Now-1.11-SNAPSHOT.war" (runtime-name : "Now-1.11-SNAPSHOT.war")
2020-02-26 07:21:14,133 INFO  [org.wildfly.clustering.server] (LegacyDistributedSingletonService - 1) WFLYCLSV0001: This node will now operate as the singleton provider of the jboss.deployment.unit."Now-1.11-SNAPSHOT.war".installer service

But i disable-renable or deploy next time: It shows same logs in two server.

An there is scheduler which runs twice which is corrupting database with duplicates.

Need to redeploy and redeploy and check when logs went fine i.e only one server is elected.

Project Structure:

webapp -> Meta INF -> singleton-deployment.xml

<?xml version="1.0" encoding="UTF-8"?>
<singleton-deployment xmlns="urn:jboss:singleton-deployment:1.0"/>

Scheduler Starts like:

@Startup
@Singleton
@AccessTimeout(value = 30, unit = TimeUnit.MINUTES)
public class SnowPollerNew {

Any suggestion why do it runs fine but do not runs fine many a time.

Is it linked to JGroups? or communication between two clusters?


Solution

  • You need to ensure that the servers are building the cluster correctly. Also I remember some issues (WFLY-11619) with the singleton election. I would suppose that this is not reproducable at WildFly 18.