Bug 688000 - HibernateDetachUtility trying to scrub HashMap$MapSet
Summary: HibernateDetachUtility trying to scrub HashMap$MapSet
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 4.0.0.B02
Hardware: Unspecified
OS: Unspecified
high
high vote
Target Milestone: ---
: ---
Assignee: John Mazzitelli
QA Contact: Corey Welton
URL:
Whiteboard:
Depends On:
Blocks: rhq4 712192
TreeView+ depends on / blocked
 
Reported: 2011-03-16 01:10 UTC by John Mazzitelli
Modified: 2011-06-09 19:51 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-24 01:09:42 UTC


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

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.


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