Bug 688000 - HibernateDetachUtility trying to scrub HashMap$MapSet
HibernateDetachUtility trying to scrub HashMap$MapSet
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: Core Server (Show other bugs)
4.0.0.B02
Unspecified Unspecified
high Severity high (vote)
: ---
: ---
Assigned To: John Mazzitelli
Corey Welton
:
Depends On:
Blocks: rhq4 712192
  Show dependency treegraph
 
Reported: 2011-03-15 21:10 EDT by John Mazzitelli
Modified: 2011-06-09 15:51 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-05-23 21:09:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
test plugin (10.87 KB, application/x-java-archive)
2011-03-17 16:18 EDT, John Mazzitelli
no flags Details

  None (edit)
Description John Mazzitelli 2011-03-15 21:10:22 EDT
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 17:15:06 EDT
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 12:09:03 EDT
fyi: this code was introduced in the last checkin to the hib detach util: commit ce0ad5c39ee6dae175d0771751b00863e8b775e4
Comment 3 John Mazzitelli 2011-03-17 16:18:01 EDT
Created attachment 486094 [details]
test plugin
Comment 4 John Mazzitelli 2011-03-17 16:20:20 EDT
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 16:30:17 EDT
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-23 21:09:42 EDT
Bookkeeping - closing bug - fixed in recent release.

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