Bug 688000

Summary: HibernateDetachUtility trying to scrub HashMap$MapSet
Product: [Other] RHQ Project Reporter: John Mazzitelli <mazz>
Component: Core ServerAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Corey Welton <cwelton>
Severity: high Docs Contact:
Priority: high    
Version: 4.0.0.B02CC: mfoley
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-24 01:09:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 585306, 712192    
Attachments:
Description Flags
test plugin none

Description John Mazzitelli 2011-03-16 01:10:22 UTC
I am consistently seeing this:

Caused by: com.google.gwt.user.client.rpc.SerializationException: Type 'org.rhq.core.domain.resource.Resource_$$_javassist_30' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = Resource[id=10501, type=ABC, key=Processor, name=Processor, parent=XYZ]
	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:610)

After some debugging, here's the root cause:

21:06:40,196 ERROR [HibernateDetachUtility] java.lang.UnsupportedOperationException
	at java.util.AbstractCollection.add(AbstractCollection.java:221)
	at java.util.AbstractCollection.addAll(AbstractCollection.java:305)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutUninitializedFields(HibernateDetachUtility.java:117)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutFieldsByFieldAccess(HibernateDetachUtility.java:274)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutFieldsByFieldAccess(HibernateDetachUtility.java:174)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutUninitializedFields(HibernateDetachUtility.java:159)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutFieldsByFieldAccess(HibernateDetachUtility.java:274)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutFieldsByFieldAccess(HibernateDetachUtility.java:174)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutUninitializedFields(HibernateDetachUtility.java:159)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutFieldsByFieldAccess(HibernateDetachUtility.java:267)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutFieldsByFieldAccess(HibernateDetachUtility.java:174)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutUninitializedFields(HibernateDetachUtility.java:159)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutFieldsByFieldAccess(HibernateDetachUtility.java:203)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutFieldsByFieldAccess(HibernateDetachUtility.java:174)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutUninitializedFields(HibernateDetachUtility.java:159)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutUninitializedFields(HibernateDetachUtility.java:99)
	at org.rhq.enterprise.server.util.HibernateDetachUtility.nullOutUninitializedFields(HibernateDetachUtility.java:61)
	at org.rhq.enterprise.gui.coregui.server.util.SerialUtility.prepare(SerialUtility.java:41)
	at org.rhq.enterprise.gui.coregui.server.gwt.ResourceGWTServiceImpl.getResourceLineageAndSiblings(ResourceGWTServiceImpl.java:169)

This is really bad. We are trying to scrub HashMap$KeySet sets but we can't call addAll. I tried several ways to work around this but can't figure it out yet.

Comment 1 John Mazzitelli 2011-03-16 21:15:06 UTC
i had this replicatable. but I uninventoried some things and now I can't see it again. I thought it had to do with deep hierarchies, but I have a test plugin with 4-levels deep of resources and I'm not seeing this anymore.

I know this problem still exists. We need replication steps to figure out how to get this to happen on demand.

Comment 2 John Mazzitelli 2011-03-17 16:09:03 UTC
fyi: this code was introduced in the last checkin to the hib detach util: commit ce0ad5c39ee6dae175d0771751b00863e8b775e4

Comment 3 John Mazzitelli 2011-03-17 20:18:01 UTC
Created attachment 486094 [details]
test plugin

Comment 4 John Mazzitelli 2011-03-17 20:20:20 UTC
commit 189da6b

we put all the elements of the Set in an  intermediate list, recurse through that list to null out the elements, then we put those list elements (now converted) into a Set that we put into the field (since the field's type is really a Set).

The only way I was able to test this was with a deep hierarchy. You can try the attached test plugin. Deploy this new plugin, when the agent picks it up and auto-detects the "Top Server", import it from the auto-discovery queue. Then manually add a "Child" resource under Top Server. After a while, there will be GrandChild and GreatGrandChild resources under the Child resource. Navigate all the way to a GreatGrandChild resource and select its node from the left hand tree. Then hit F5 in the browser. It should refresh and still show you the left hand tree that is drilled down all the way to the selected GreatGrandChild resource.

Comment 5 Mike Foley 2011-05-03 20:30:17 UTC
verifying RHQ 4.0 community release as follows:  uploaded the attached plugin, did "plugins update" on the agent, imported the resource "My Top Server".  added a child resource, waited ... went to the grandchild, hit F5.  reviewed server logs, all good.

Comment 6 Corey Welton 2011-05-24 01:09:42 UTC
Bookkeeping - closing bug - fixed in recent release.