Bug 1150667 - Availability of host controller is down due to ArrayIndexOutOfBoundsException
Summary: Availability of host controller is down due to ArrayIndexOutOfBoundsException
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Plugin -- JBoss EAP 6
Version: JON 3.2.3
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: ER04
: JON 3.3.0
Assignee: Thomas Segismont
QA Contact: Mike Foley
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-08 15:42 UTC by bkramer
Modified: 2018-12-09 18:48 UTC (History)
5 users (show)

(edit)
A bug in the Application Platform Plug-in Pack caused issues with properly discovering the availability of the slave host controller. The slave host controller was discovered, however it's availability check failed with an ArrayIndexOutOfBounds Exception. The fix implements improvements to BaseServerComponent#findASHostName(), which now uses the EAP 6 management API to fetch the local-host-name attribute from the host controller. The host or domain controller state is recorded correctly, which fixes the originally reported bug.
Clone Of:
(edit)
Last Closed: 2014-12-11 13:59:14 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Bugzilla 1128141 None None None Never

Internal Trackers: 1128141

Description bkramer 2014-10-08 15:42:39 UTC
Description of problem:
Host Controller is properly discovered but it's availability check fails with following message:

*******************
DEBUG [ResourceContainer.invoker.daemon-11] (rhq.modules.plugins.jbossas7.BaseServerComponent)- ResourceType[id=0, name=JBossAS7 Host Controller, plugin=JBossAS7, category=Server] [hostConfig: /apps/test/test-node1/host-controller/configuration/host-slave.xml]: exception while checking availability
java.lang.ArrayIndexOutOfBoundsException: 1
	at org.rhq.modules.plugins.jbossas7.json.Address.pathFromSegment(Address.java:107)
	at org.rhq.modules.plugins.jbossas7.json.Address.<init>(Address.java:93)
	at org.rhq.modules.plugins.jbossas7.HostControllerComponent.getHostAddress(HostControllerComponent.java:248)
	at org.rhq.modules.plugins.jbossas7.BaseServerComponent.getAvailabilityNow(BaseServerComponent.java:165)
	at org.rhq.modules.plugins.jbossas7.BaseServerComponent.getAvailability(BaseServerComponent.java:152)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocation.call(ResourceContainer.java:654)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
*******************

The command line arguments for the Host Controller are:

    /usr/java/jdk1.7.0_67/bin/java, 
	-D[Host Controller], 
	-Dorg.jboss.boot.log.file=/apps/test/test-node1/host-controller/log/host-controller.log, 
	-Dlogging.configuration=file:/apps/test/test-node1/host-controller/configuration/logging.properties, 
	-server, 
	-Xms64m, 
	-Xmx512m, 
	-XX:MaxPermSize=256m, 
	-Djava.net.preferIPv4Stack=true, 
	-Djboss.modules.system.pkgs=org.jboss.byteman, 
	-Djava.awt.headless=true, 
	-Djboss.modules.policy-permissions=true, 
	-jar, /apps/test/jboss-eap-6.3/jboss-modules.jar, 
	-mp, /apps/test/jboss-eap-6.3/modules, 
	-jaxpmodule, javax.xml.jaxp-provider, 
	org.jboss.as.host-controller, 
	-mp, /apps/test/jboss-eap-6.3/modules, 
	--pc-address, 127.0.0.1, 
	--pc-port, 38065, 
	-default-jvm, /usr/java/jdk1.7.0_67/bin/java, 
	--backup, 
	--host-config=host-slave.xml, 
	-Djboss.host.name=test-node1, 
	-Djboss.domain.base.dir=/apps/test/test-node1/host-controller, 
	-Djboss.domain.master.address=10.33.0.12, 
	-Djboss.bind.address=10.33.0.12, 
	-Djboss.home.dir=/apps/test/jboss-eap-6.3], 
	includeSystemPropertiesFromClassArguments=true, 
	shortClassOptionFormat=[WHITESPACE, EQUALS_SIGN], 
	longClassOptionFormat=[WHITESPACE, EQUALS_SIGN]


Version-Release number of selected component (if applicable):
- JBoss ON 3.2.3
- Application Platform Plugin Pack Update-01 for JBoss ON 3.2 

How reproducible:
Not sure.

Steps to Reproduce:
1. 
2.
3.

Actual results:
Host Controller is properly discovered but it's availability is down

Expected results:
Host Controller is properly discovered and it's availability is up

Additional info:
host-slave.xml file will be additionally attached

Above error shows that exception happens when trying to get name parameter (see plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java):

************************************************
...
162     private AvailabilityType getAvailabilityNow(int timeoutSec) {
163         AvailabilityType availabilityType;
164         try {
165             readAttribute(getHostAddress(), "name");
166             availabilityType = AvailabilityType.UP;
167         } 
...
************************************************

but this fails in plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java

************************************************
...
076     public Address(String path) {
077         this();
078         if (path == null || path.isEmpty())
079             return;
080         // strips / from the start or end of the key if it happens to be there
081         if (path.startsWith("/")) {
082             path = path.substring(1);
083         }
084         if (path.endsWith("/")) {
085             path = path.substring(0,path.length()-1);
086         }
087         // Now split on comma boundaries
088         String[] components = path.split("[,]+");
089         for (String component : components) {
090             String tmp = component.trim();
091             // Split each segment on equals sign into key and value
092             if (tmp.contains("=")) {
093                 PROPERTY_VALUE valuePair = pathFromSegment(tmp);
094                 this.path.add(valuePair);
095             }
096         }
097 
098     }
099 
100     /**
101      * Generates a path from a segment in the form of key=value.
102      * @param segment A segment in the form key=value
103      * @return A path
104      */
105     private PROPERTY_VALUE pathFromSegment(String segment) {
106         String[] pair = segment.split("=");
107         return new PROPERTY_VALUE(pair[0], pair[1]);
108     }
109 
...
************************************************

So, line  "107 return new PROPERTY_VALUE(pair[0], pair[1]);" fails because there is no pair[1], but only pair[0].


Note You need to log in before you can comment on or make changes to this bug.