[
https://issues.redhat.com/browse/MODCLUSTER-711?page=com.atlassian.jira.p...
]
Radoslav Husar commented on MODCLUSTER-711:
-------------------------------------------
After looking more thoroughly at the code, the usage with multiple services works as
expected. For example a config with multiple services each with one connector defined, no
connectorPort/connectorAddress defined (thus *:* filters out the one connector configured
for each service), registers both engines and both connectors with the proxy.
So the problem is that there is currently no way currently to exclude which
service/engines to register with the proxy which is actually a feature request. It should
be sufficient in this case to leverage connectorPort/connectorAddress to refine which
connectors to use and which engines to register, so rather than throwing an exception, we
could just exclude an engine without a configured connector.
While at it, the wording for "MODCLUSTER000047: No configured connector matches
specified host:port (*:8081)! Ensure connectorPort and/or connectorAddress are
configured." is a bit misleading, so that should be updated as well.
Using "connectorPort" property fails if multiple services
are configured in Tomcat
----------------------------------------------------------------------------------
Key: MODCLUSTER-711
URL:
https://issues.redhat.com/browse/MODCLUSTER-711
Project: mod_cluster
Issue Type: Bug
Components: Core & Container Integration (Java)
Affects Versions: 1.4.0.Final
Reporter: Tomas Briceno Fernandez
Assignee: Radoslav Husar
Priority: Major
Fix For: 2.0.0.Alpha1, 1.4.2.Final
If the Tomcat server configuration has several <service> elements and the
mod_cluster listener is configured with *connectorPort* (most probably it is the same with
*connectorAddress*), the configuration fails with these messages:
{code}
06-Feb-2020 16:11:17.596 INFO [ContainerBackgroundProcessor[StandardEngine[TestEngine]]]
org.jboss.modcluster.ModClusterService.connectionEstablished MODCLUSTER000012: TestEngine
connector will use /127.0.0.1
06-Feb-2020 16:11:17.598 INFO [ContainerBackgroundProcessor[StandardEngine[TestEngine]]]
org.jboss.modcluster.ModClusterService.establishJvmRoute MODCLUSTER000011: TestEngine will
use 7bb39e02-96c0-3f8f-9fab-d464ad729cfe as jvm-route
06-Feb-2020 16:11:17.598 SEVERE
[ContainerBackgroundProcessor[StandardEngine[TestEngine]]]
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren
Exception invoking periodic operation:
java.lang.RuntimeException: MODCLUSTER000047: No configured connector matches specified
host:port (*:8081)! Ensure connectorPort and/or connectorAddress are configured.
at
org.jboss.modcluster.container.tomcat.ConfigurableProxyConnectorProvider.createProxyConnector(ConfigurableProxyConnectorProvider.java:89)
at
org.jboss.modcluster.container.tomcat.TomcatEngine.getProxyConnector(TomcatEngine.java:140)
at
org.jboss.modcluster.ModClusterService.connectionEstablished(ModClusterService.java:267)
at
org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler.status(DefaultMCMPHandler.java:341)
at
org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler.status(DefaultMCMPHandler.java:315)
at org.jboss.modcluster.ModClusterService.status(ModClusterService.java:388)
at
org.jboss.modcluster.container.tomcat.TomcatEventHandlerAdapter.lifecycleEvent(TomcatEventHandlerAdapter.java:229)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1174)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1396)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1368)
at java.lang.Thread.run(Thread.java:748)
{code}
My own code inspection suggests this is because of this loop :
{code:title=org.jboss.modcluster.ModClusterService}
@Override
public void connectionEstablished(InetAddress localAddress) {
for (Engine engine : this.server.getEngines()) {
Connector connector = engine.getProxyConnector();
InetAddress address = connector.getAddress();
// Set connector address
if ((address == null) || address.isAnyLocalAddress()) {
connector.setAddress(localAddress);
ModClusterLogger.LOGGER.detectConnectorAddress(engine, localAddress);
}
this.establishJvmRoute(engine);
}
this.established = true;
}
{code}
The problem here is that the invocation of *engine.getProxyConnector()* will check if one
and only one of the connectors in the engine matches the port configured by
*connectorPort*. If more that one service is configured there will be multiple engines and
this code will apply the previous condition to all of them. That is, to properly exit this
method the port should exist in all engines, which will not happen normally.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)