Request for review: 6597112: Referential integrity loophole during remote object export

Alan Bateman Alan.Bateman at oracle.com
Wed Mar 9 10:45:44 UTC 2011


Neil Richards wrote:
> Bug 6597112 [1] reports that the implementation of
> java.rmi.server.UnicastRemoteObject.exportObject(Remote) has a window
> in which the Remote object given to the method is only weakly
> referenced by the implementation.
>
> Due to this window, an unfortunately timed GC cycle can free up the
> Remote object, causing an exception to be thrown at a later point
> (still) within the exportObject() implementation.
>   
I don't know the RMI code so this isn't a formal review, just a 
comment/question from skimming the webrev.

You've changed WeakRef so that an instance is initially "strong". Does 
this have implications for other uses of WeakRef? I see one in 
sun.rmi.transport.ObjectTable for example. I wonder if it would be 
better to change the constructors so that the user of WeakRef decides 
the reference is initially pinned or not. Alternatively maybe factory 
methods should be introduced for all creation of WeakRefs and they be 
named so that it's clear where the WeakRefs are initially strong or not. 
Same thing with Target where I wonder about other uses as they will need 
to know that the impl is initially pinned.

Otherwise it's good to get this bug fixed.

-Alan.





More information about the core-libs-dev mailing list