Bug 788334

Summary: NullPointerException thrown from AvailabilityManagerBean
Product: [Other] RHQ Project Reporter: Elias Ross <genman>
Component: Core ServerAssignee: Heiko W. Rupp <hrupp>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.1CC: hrupp
Target Milestone: ---   
Target Release: RHQ 4.3.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-01 06:19:02 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Elias Ross 2012-02-07 23:21:05 EST
Description of problem:

I've been doing development of plugins and noticed the following in the logs.

2012-02-05 20:47:36,072 INFO  [org.rhq.enterprise.server.discovery.DiscoveryServerServiceImpl] Error processing availability report from [vg61l01ad-hadoop002]: javax.ejb.EJBException:java.lang.NullPointerException -> java.lang.NullPointerException:null

I traced the problem down to something being null in AvailabilityManagerBean.mergeAvailabilityReport().

It's not clear if the issue is coming from a bad plugin. My plugin would fail to return from its start() method and I suppose this might have prevented some database process from occurring.

The resources do appear in the tree, however, they are all unavailable.

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

RHQ 4.1, but the code seems to not have changed recently.

How reproducible:

Removing the resource (server) and discovering it again doesn't seem to cause it to clear.

Steps to Reproduce:
1. Create a bad(?) plugin; deploy
2. Discovery fails (or never completes) as the start() method fails.
3. Notice the logs
Expected results:

The server should guard against bad data and provide some indication what was bad about the data.

Additional info:

I will provide more information as I find it.
Comment 1 Heiko W. Rupp 2012-02-08 06:05:12 EST
I have seen something similar with the very first availability report of a new resource.

The problem is in org.rhq.enterprise.server.measurement.AvailabilityManagerBean#updateResourceAvailability where the variable 'currentAvailability' is null for when no ResourceAvailability has been set, as this was the first report to come in.
Comment 2 Heiko W. Rupp 2012-02-08 06:10:08 EST
master 34ed3853dda
Comment 3 Elias Ross 2012-02-08 12:28:46 EST
I'll test and verify. However, wouldn't this case happen very frequently?

Looking at the commit, I'd also feel better about this if there was a unit test case added as well. Is there such a test for your EJB components?
Comment 4 Heiko W. Rupp 2013-09-01 06:19:02 EDT
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.