CDV ❯ Serialization of shared objects fails to resolve reference fields
-
Bug
-
Status: Closed
-
2 Major
-
Resolution: Fixed
-
DSO:L1
-
-
hhuynh
-
Reporter: teck
-
April 26, 2007
-
0
-
Watchers: 2
-
September 26, 2008
-
September 16, 2008
Description
From the forums: http://forums.terracotta.org/forums/posts/list/0/226.page
If a shared object is serialized, it possible to observe unresolved reference values. I believe the reason for this is that field values are read using sun.misc.Unsafe.getObject(..). Specifically in java.io.ObjectStreamClass$FieldReflector.getObjFieldValues(). This method of reading field data will bypass the DSO mechanics for resolving fields.
I don’t think fields that are DSO literal types are affected since they are never unresolved.
I’m not sure about logical collections – although I guess they are okay since they implement readObject/writeObject in terms of their iterators which do flow though DSO goodness.
Comments
Fiona OShea 2007-04-27
Fiona OShea 2007-05-31
Is this still a problem?
Geert Bevin 2007-09-17
Adding comment that Tim sent on June 22nd through email, just to be able to track it:
I don’t think anything has been done about it.
Only two things I can think of to fix the prob: 1) Make sun.misc.Unsafe.getObject() do the dso magic when used on shared instances.
2) Use TCObject.resolveAllReferences() while holding the resolve lock such that the Unsafe only reads resolved field values. You’ll want to hold the resolve lock for the duration of both the resolveAllRefs and the unsafe calls.
#1 seems slightly preferable since it will fix any other use of that method on shared instances, but it might be hard since it is a native call, and it is unclear if adding overhead there will make the world unhappy
Tim Eck 2008-09-12
I think should be fixed in trunk now as of rev 10044
Scott Bale 2008-09-15
Looks like still a problem at least for clustered HashMap instances. With Tim’s help I’ve duplicated Himadri’s problem by adding to the system test that Tim wrote for this issue.
Scott Bale 2008-09-16
similar Serialization issue, both affect Lassen Exam caching
Scott Bale 2008-09-16
Alex and I decided there should really be a new JIRA issue, because it is really a new (albeit related) problem (CDV-907) that has been found. Tim’s fix for this issue is fine and needs to be in 2.7 branch.
Hung Huynh 2008-09-19
test existed.
Ask for help when you get to looking at this..