Bug 1382041 - Discovery of ActiveMQ fails with NullPointerException when credentials name is not set
Summary: Discovery of ActiveMQ fails with NullPointerException when credentials name i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Core Server
Version: JON 3.3.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ER01
: JON 3.3.8
Assignee: Michael Burman
QA Contact: Prachi
URL:
Whiteboard:
: 1289445 (view as bug list)
Depends On: 1382043
Blocks: 1289445
TreeView+ depends on / blocked
 
Reported: 2016-10-05 14:55 UTC by bkramer
Modified: 2019-12-16 07:00 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-16 18:45:35 UTC
Type: Bug


Attachments (Terms of Use)
active mq logs (221.37 KB, image/png)
2017-01-25 12:18 UTC, Prachi
no flags Details
error.png (109.90 KB, image/png)
2017-01-25 12:19 UTC, Prachi
no flags Details
JON server log (48.26 KB, text/plain)
2017-01-25 12:39 UTC, Prachi
no flags Details
JON agent log (398.63 KB, text/plain)
2017-01-25 12:39 UTC, Prachi
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2649721 0 None None None 2016-11-15 17:33:20 UTC
Red Hat Product Errata RHEA-2017:0285 0 normal SHIPPED_LIVE Red Hat JBoss Operations Network 3.3.8 bug fix update 2017-02-16 23:44:22 UTC

Description bkramer 2016-10-05 14:55:48 UTC
Description of problem:
If credname returned by sigar is not set (null) discovery of the ActiveMQ server fails with NullPointerException:

********************************************
DEBUG [ResourceDiscoveryComponent.invoker.daemon-1] (org.jbosson.plugins.fuse.JBossFuseContainerDiscoveryComponent)- Error when trying to discover Fuse Server process [ProcessScanResult: scan=[ProcessScan: query=[process|basename|match=^java.*,arg|-Dkaraf.home|match=.*,arg|-Dkaraf.base|match=.*,arg|*|match=org\.apache\.karaf\.(main|shell\.wrapper)\.Main], name=[null]], info=[process: pid=[29383], name=[/app/software/jdk1.7.0_55/bin/java], ppid=[29336]]].
java.lang.RuntimeException: Failed to extract JMX service URL for process with PID [29383].
	at org.rhq.plugins.jmx.util.JvmUtility.extractJMXServiceURL(JvmUtility.java:93)
	at org.jbosson.plugins.fuse.FuseServerDiscoveryComponent.discoverResourceDetails(FuseServerDiscoveryComponent.java:273)
	at org.jbosson.plugins.fuse.FuseServerDiscoveryComponent.discoverResources(FuseServerDiscoveryComponent.java:94)
	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.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:305)
	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)
Caused by: java.lang.NullPointerException
	at org.rhq.plugins.jmx.util.JvmUtility.attachToVirtualMachine(JvmUtility.java:107)
	at org.rhq.plugins.jmx.util.JvmUtility.extractJMXServiceURL(JvmUtility.java:76)
	... 10 more
********************************************

Normally, pinfo returns credname set as in [2].

[1] 
*********************************************
[testUser@test lib] java -jar 'sigar-1.6.5.132-6.jar' pinfo 54804
pid=54804
state={Name=java, Threads=332, Tty=0, State=S, Ppid=54760, Processor=1, Priority=20, Nice=0}
mem={Resident=3802157056, PageFaults=37230840, MajorFaults=0, Share=21520384, MinorFaults=37230840, Size=7872376832}
cpu={User=13370920, LastTime=1475081008046, Percent=0.0, StartTime=1474974387000, Total=14365690, Sys=994770}
cred={Euid=25958, Gid=25958, Egid=25958, Uid=25958}
*********************************************

[2] 
*********************************************
[testUser@test lib]$ java -jar 'sigar-1.6.5.132-6.jar' pinfo 26418
pid=26418
state={Name=java, Threads=108, Tty=34819, State=S, Ppid=26368, Processor=7, Priority=20, Nice=0}
mem={Resident=372408320, PageFaults=187036, MajorFaults=0, Share=23486464, MinorFaults=187036, Size=5299863552}
cpu={User=108750, LastTime=1475220798994, Percent=0.0, StartTime=1475159585000, Total=150960, Sys=42210}
cred={Euid=1000, Gid=1000, Egid=1000, Uid=1000}
credname={User=testUser, Group=testUser}
*********************************************

Version-Release number of selected component (if applicable):
JBoss ON 3.3.0

How reproducible:
Sometimes (when user is ldap user);

Steps to Reproduce:
1.
2.
3.

Actual results:
Autodiscovery fails and NullPointerException is logged. 

Expected results:
Autodiscovery works and no error is shown in the log file. In case that credname is null, we should try to use some other way of attaching to JVM.

Additional info:

Comment 1 Michael Burman 2017-01-13 12:21:25 UTC
By default, we use other method than attach. Attach is only a fallback and requires the agent to be running as same user as the attached process.

The only possible fix (to make the connection) here is to compare the (E)UIDs of the agent and the target process, if the credName is really missing.

Comment 2 Michael Burman 2017-01-13 12:38:45 UTC
Fixed in the master:

commit 87208f971b4e78c6236abcc9ea50c4ec34825825
Author: Michael Burman <miburman>
Date:   Fri Jan 13 14:38:11 2017 +0200

    [BZ 1382041] If procCredName is not available, use process eUid comparison for attach capabilities

Comment 3 Michael Burman 2017-01-13 13:08:17 UTC
Lets add this one to the previous one:

commit 6f7107850611ccf9bc32cce79bed81cb75fa6f79
Author: Michael Burman <miburman>
Date:   Fri Jan 13 15:07:13 2017 +0200

    Replace direct Sigar access with proxy

Comment 6 Simeon Pinder 2017-01-23 15:00:34 UTC
*** Bug 1289445 has been marked as a duplicate of this bug. ***

Comment 7 Prachi 2017-01-25 12:17:46 UTC
Tested in JON 3.3.8 ER01.

Issue 1: Able to discover ActiveMQ in JON successfully. However, in logs of JON (server.log attached) in is showing product as JBoss, which is not correct, it should show ActiveMQ. But in UI it shows Jboss fuse Container

Issue 2: Not able to monitor ActiveMQ

Steps followed:

1) Edit jboss-a-mq-6.2.1.redhat-159/etc/users.properties to add admin user:
   
   "admin=admin,admin,manager,viewer,Operator, Maintainer, Deployer, Auditor, Administrator, SuperUser"

2) navigate to Jboss Fuse container >> Inventory >> Connection Settings

3) edit Principal and Credentials as admin, admin.

After these settings JON should display ActiveMQ available as Active MQ is running successfully(attached screen-shot "activemq.png"). However, it is not showing any error in server.log of JON or agent.log of agent but in JON UI it shows error(attached screen-shot error.png).

Comment 8 Prachi 2017-01-25 12:18:49 UTC
Created attachment 1244234 [details]
active mq logs

Comment 9 Prachi 2017-01-25 12:19:52 UTC
Created attachment 1244236 [details]
error.png

Comment 10 Prachi 2017-01-25 12:39:22 UTC
Created attachment 1244244 [details]
JON server log

Comment 11 Prachi 2017-01-25 12:39:53 UTC
Created attachment 1244245 [details]
JON agent log

Comment 12 Michael Burman 2017-01-25 13:47:31 UTC
If it's detected as "JBoss Fuse Container" incorrectly, then this is something that JBoss Fuse / ActiveMQ plugin authors should fix, it's not a bug in the JON 3.3.8.

But that has nothing to do with the original bug, which is about JMX detection with undetected userName. And that does not fail.

Comment 13 Larry O'Leary 2017-01-25 14:39:18 UTC
I believe this bug should be marked VERIFIED and new bugs should be captured for any new issues. This bug is about discovery while the others appear to be related to specific functions of the plug-in or a configuration issue.

For issue 1., you will need to provide complete steps in the new bug as it is not clear. Active-MQ from this BZ is part of Fuse and would be deployed to an EAP server. Therefore, it would either get identified with EAP as its parent resource or a layered JBoss Fuse Container parent resource.

For issue 2., an agent debug log would be helpful. Also, please keep in mind that if any of your steps were performed out of order or timing was an issue, a service discovery scan would need to be performed. 

Moving back to ON_QA for further action.

Comment 14 Prachi 2017-02-01 11:36:29 UTC
Created new bugs for new issues. So keeping this bug as verified because able discover ActiveMQ in JON 3.3.8 ER01

Comment 15 errata-xmlrpc 2017-02-16 18:45:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2017-0285.html


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