Bug 1125343 - All content-related workflows broken on Agent
Summary: All content-related workflows broken on Agent
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Plugin Container
Version: JON 3.3.0
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: ER02
: JON 3.3.0
Assignee: Thomas Segismont
QA Contact: Filip Brychta
URL:
Whiteboard:
: 1117755 (view as bug list)
Depends On: 1096332
Blocks: JON3-42
TreeView+ depends on / blocked
 
Reported: 2014-07-31 15:35 UTC by Thomas Segismont
Modified: 2014-12-11 14:02 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1096332
Environment:
Last Closed: 2014-12-11 14:02:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1117755 0 urgent CLOSED [eap6 ] cannot create deployment resource , broken after restart 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1133985 0 unspecified CLOSED Deploying an application on EAP5 results to NPE 2021-02-22 00:41:40 UTC

Internal Links: 1117755 1133985

Description Thomas Segismont 2014-07-31 15:35:51 UTC
+++ This bug was initially created as a clone of Bug #1096332 +++

Description of problem:
Due to overly eager initialization of resource context, the content services are not available to the resource components, essentially rendering any content related work (CreateChildFacet and ContentFacet) unusable. (Any attempt to use ContentContext.getContentServices() (needed for example to download packages from the server) results in an NPE.

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

How reproducible:
always

Steps to Reproduce:
1. Try to deploy a WAR into JBoss AS7 through the create child facility of RHQ

Actual results:
Always fails

Expected results:
Succeeds

Additional info:
This is a regression caused by BZ 991149

--- Additional comment from Lukas Krejci on 2014-05-12 14:54:00 CEST ---



--- Additional comment from Lukas Krejci on 2014-05-12 14:55:42 CEST ---

See BZ 1068630 for a concrete example of the NPE this produces in the AS7 plugin.

--- Additional comment from John Mazzitelli on 2014-05-12 15:44:45 CEST ---

I reopened bug #991149 since that's the one that introduced the regression.

--- Additional comment from Lukas Krejci on 2014-05-16 11:15:24 CEST ---

Seems to have been a problem with my local build. I can't really explain what happened, but I can no longer replicate this. Closing.

--- Additional comment from Thomas Segismont on 2014-07-31 17:14:35 CEST ---



--- Additional comment from Thomas Segismont on 2014-07-31 17:31:06 CEST ---

Just hit the problem again. New investigation shows that this regression was indeed introduced by the work for Bug 991149. Here's the issue.

All PC subsystems are initialized in org.rhq.core.pc.PluginContainer#initialize

InventoryManager is initialized *before* the ContentManager

When InventoryManager is initialized, it activates already inventoried resources recursively. Inventoried resources which have child types creatable by content are given a org.rhq.core.pluginapi.content.ContentContext instance. The problem is the ContentContext holds a null reference to ContentManager, because at this point the Content manager is not initialized, and not even created.

The consequences are the following:
* resources added to inventory *after* the PC started will be able to use the content services, because when the resource context is created, the content manager is already initialized
* resources *already* in inventory when the PC is started will not be able to use the content services.

A good test to check if this issue is resolved is:

1. create new RHQ environment
2. inventory an AS7 / EAP6 standalone server
3. create a new Deployment child resource
4. check the child resource creation works
5. delete the child resource
6. restart the agent
5. create the Deployment child resource again

Step 5 five won't work without a fix

Working on the fix ASAP

Comment 1 Thomas Segismont 2014-08-01 16:25:38 UTC
Fixed in master

commit 8668677a01100d22e6799ce3f73f58b92a1b030c
Author: Thomas Segismont <tsegismo>
Date:   Fri Aug 1 18:22:34 2014 +0200

All *ContextImpl classes now lazy load plugin container services

The content subsystem was the only one affected as:
* some of the other managers were created and initialized before the inventory manager
* some of the *ContextImpl classes were already lazy loading the container services

Comment 2 Thomas Segismont 2014-08-01 17:15:24 UTC
Additional commit in master, some itest classes were broken

commit 82fba05c62d5a5036455fa936cfa045f60b4724c
Author: Thomas Segismont <tsegismo>
Date:   Fri Aug 1 19:13:20 2014 +0200

Comment 3 Thomas Segismont 2014-08-19 17:30:53 UTC
Reverted on master

commit 24baf850306bcf58ecf35b1d327ae33ceca3c999
Author: Thomas Segismont <tsegismo>
Date:   Tue Aug 19 16:53:16 2014 +0200

This reverts commit 8668677a01100d22e6799ce3f73f58b92a1b030c and 82fba05c62d5a5036455fa936cfa045f60b4724c
    
Re-introducing lazy loading is a bad idea.

Comment 4 Thomas Segismont 2014-08-19 17:31:08 UTC
Fixed in master

commit 2f359251836f5ce82b0fcd28903e423082326051
Author: Thomas Segismont <tsegismo>
Date:   Tue Aug 19 19:23:53 2014 +0200
    
All *ContextImpl classes now user eagerly loaded plugin container services
    
The content subsystem was the only one affected as:
* some of the other managers were created and initialized before the inventory manager
* some of the *ContextImpl classes were still lazy loading container services

Comment 6 Thomas Segismont 2014-08-21 13:54:09 UTC
Additional commit in master

commit aefe29a44961fc723d5241d6b67bea2f2f3ccaf7
Author: Thomas Segismont <tsegismo>
Date:   Thu Aug 21 12:33:38 2014 +0200

Create and initialize managers in order

Passes rhq-core-plugin-container tests rhq-core-plugin-container-itest tests.
Passes manual testing of an AS7 resource:
* events
* content
* measurement
* operation
(before and after restart of the plugin container)

Comment 7 Lukas Krejci 2014-08-21 18:04:32 UTC
commit 0d7980daf2b46ca3abf19740a25aa5faf22b1a1f
Author: Thomas Segismont <tsegismo>
Date:   Thu Aug 21 12:33:38 2014 +0200

    Bug 1096332 - All content-related workflows broken on Agent
    
    Create and initialize managers in order
    
    Passes rhq-core-plugin-container tests rhq-core-plugin-container-itest tests.
    Passes manual testing of an AS7 resource:
    * events
    * content
    * measurement
    * operation
    (before and after restart of the plugin container)
    
    (cherry picked from commit aefe29a44961fc723d5241d6b67bea2f2f3ccaf7)
    Signed-off-by: Lukas Krejci <lkrejci>

commit 6a0cb4d336db879539e98e3695a4002dd69f80b6
Author: Thomas Segismont <tsegismo>
Date:   Tue Aug 19 19:23:53 2014 +0200

    Bug 1096332 - All content-related workflows broken on Agent
    
    All *ContextImpl classes now user eagerly loaded plugin container services
    
    The content subsystem was the only one affected as:
    * some of the other managers were created and initialized before the inventory manager
    * some of the *ContextImpl classes were still lazy loading container services
    
    (cherry picked from commit 2f359251836f5ce82b0fcd28903e423082326051)
    Signed-off-by: Lukas Krejci <lkrejci>

Comment 8 Thomas Segismont 2014-08-22 15:43:15 UTC
*** Bug 1117755 has been marked as a duplicate of this bug. ***

Comment 9 Simeon Pinder 2014-09-03 20:31:22 UTC
Moving to ON_QA as available for test with the following brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=381194

Comment 10 Filip Brychta 2014-09-08 08:41:55 UTC
Verified on
Version :	
3.3.0.ER02
Build Number :	
4fbb183:7da54e2


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