+++ 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
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
Additional commit in master, some itest classes were broken commit 82fba05c62d5a5036455fa936cfa045f60b4724c Author: Thomas Segismont <tsegismo> Date: Fri Aug 1 19:13:20 2014 +0200
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.
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
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)
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>
*** Bug 1117755 has been marked as a duplicate of this bug. ***
Moving to ON_QA as available for test with the following brew build: https://brewweb.devel.redhat.com//buildinfo?buildID=381194
Verified on Version : 3.3.0.ER02 Build Number : 4fbb183:7da54e2