Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1082093

Summary: Agent failed to shutdown component [Plugin Container]. Cause: java.lang.NullPointerException:null
Product: [JBoss] JBoss Operations Network Reporter: Viet Nguyen <vnguyen>
Component: AgentAssignee: Michael Burman <miburman>
Status: CLOSED EOL QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: unspecified    
Version: JON 3.2.1CC: fbrychta, jshaughn, loleary
Target Milestone: ---   
Target Release: JON 3.4.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-10 15:10:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
agent.log
none
agent 3.2 log
none
agent 3.3.1 log none

Description Viet Nguyen 2014-03-28 16:25:26 UTC
Created attachment 879942 [details]
agent.log

Description of problem:
NPE in agent log when a 3.2.GA agent tried to register with CP1 server.  Agent auto-upgrade was on and upgraded successfully. 


Version-Release number of selected component (if applicable):
Server: CP1
agent: 3.2.GA

How reproducible:
100%

Steps to Reproduce:
1. Install 3.2.GA + CP1
2. Register 3.2GA agent

See attachment

Comment 1 Mike Foley 2014-03-28 17:35:46 UTC
if we are supporting mixed environments (JON 3.2 GA and JON 3.2.1) then this is a blocker.  apparently we are on the client-side at least ...as we have confirmed testcases to test mixed environments from development/spinder.

Comment 2 Mike Foley 2014-03-28 17:49:41 UTC
upgrade was ultimately successful.  moving to jon 3.2.2 and removing the 3.2.1 blocker.

Comment 3 Larry O'Leary 2014-04-02 20:14:46 UTC
Moving to 3.3 as this is not a regression.

The NPE occurs because the agent isn't tolerant to the fact that its plug-in container has never been initialized. 

We need to clean this up so that the agent is shutdown cleanly in this situation:

i.e: Brand new agent of an older version then what the server is running performing an auto-upgrade on itself.

Comment 4 Jay Shaughnessy 2014-08-25 19:55:58 UTC
I think this should be re-tested with 3.3.1 when it comes out, given recent changes in auto-update.

Comment 5 Simeon Pinder 2015-01-26 08:15:04 UTC
Moving to ON_QA as available for test with the latest 3.3.1.ER01 bits from here:
http://download.devel.redhat.com/brewroot/packages/org.jboss.on-jboss-on-parent/3.3.0.GA/12/maven/org/jboss/on/jon-server-patch/3.3.0.GA/jon-server-patch-3.3.0.GA.zip

Comment 6 Viet Nguyen 2015-01-27 22:36:39 UTC
Still see NPE in both tests.  Larry/Jay please comment.

Agent log location: rhq-agent-OLD/logs/agent.log

Test1: 
- Server 3.3.1, Agent 3.2.GA (attached log: agent32.log)

Test2: 
- Server 3.2.GA, Agent 3.3.1 (attached log: agent331.log

Comment 7 Viet Nguyen 2015-01-27 22:37:37 UTC
Created attachment 984905 [details]
agent 3.2 log

Comment 8 Viet Nguyen 2015-01-27 22:38:15 UTC
Comment on attachment 984905 [details]
agent 3.2 log

Server 3.3.1, Agent 3.2.GA

Comment 9 Viet Nguyen 2015-01-27 22:38:56 UTC
Created attachment 984906 [details]
agent 3.3.1 log

Server 3.2.GA
Agent 3.3.1

Comment 10 Jay Shaughnessy 2015-01-28 19:46:36 UTC
I don't have much to add, I haven't really looked at this at all.  I don't really understand the test of a 3.2.GA server and a 3.3.1 agent.  Typically an agent version would be at or behind the server version.  In your scenario the agent should not upgrade but should rather just be rejected, I think. Anyway, I'm not sure it's a great use case.

Regardless, what Larry says above is true.  We need to protect here against an uninitialized PC (specifically, it looks like we're dying because this.configuration is null).    We should likely just exit in that case because we can't get a lock, we're clearly not initialized.

It's brute force but I guess I'd suggest in PluginContainer.shutdown just adding something like at the very top of the method:

    // this quick guard is OK but doesn't prevent several calls to shutdown() from stacking up while waiting for the lock
    if (!isRunning()) {
        log.info("Plugin container is already shut down.");

++      if (null == configuration) { // not even initialized
++          return;
++      }
    }

Comment 11 Filip Brychta 2015-02-05 19:59:33 UTC
After discussion with Viet it seems to be clear now.

Exact scenario to reproduce:
1 - install JON 3.3.0.GA
2 - register brand new agent (this means that the agent has never been registered or started before) to the server. Version of this agent is JON 3.2.0.GA

In other words, register brand new agent of an older version than the server you are registering to.

Result:
1 - it's correctly recognized that the agent is outdated
2 - auto upgrade of the agent is successful
3 - reported NPE is thrown to the agent.log

So the only issue here is the NPE in agent.log

Test2 from comment 6 is not valid.

Comment 13 Filip Brychta 2019-06-10 15:10:30 UTC
JBoss ON is coming to the end of its product life cycle. For more information regarding this transition, see https://access.redhat.com/articles/3827121.
This bug report/request is being closed. If you feel this issue should not be closed or requires further review, please create a new bug report against the latest supported JBoss ON 3.3 version.