JDK-4171278 : unreferenced callback should set context class loader before invoking user code
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.rmi
  • Affected Version: 1.2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_2.5
  • CPU: sparc
  • Submitted: 1998-09-03
  • Updated: 1999-01-15
  • Resolved: 1999-01-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.2.0 1.2fcsFixed
Related Reports
Relates :  
Description
When a remote object's "unreferenced" method is invoked by the system, it is
invoked in a separate thread created for that purpose which inherits its
"context class loader" from the thread that created it, which may be a remote
call dispatch thread (if the object's unreferenced state is due to the receipt
of a DGC clean call) or the DGC lease checker thread (if it is due to an
expired lease), which would, in turn, have inherited its "context class loader"
from a remote call dispatch thread processing some previous DGC dirty call.  In
either case, the context class loader in effect when the remote object's
unreferenced() code is invoked will be fairly arbitrary.  Because of this,
actions untaken during the execution of the unrefenreced() method that require
the correct setting of the context class loader, such as the correct resolution
of class in the return values of remote calls or the location of downloadable
URL protocol handlers, will fail.

The context class loader of the thread used to invoke the unreferenced()
method should be set to the context class loader stored for the
remote object in its corresponding Target instance-- the same context class
loader set when a remote call is dispatched to the object.

[This does make one wonder: should the access control context stored in the
remote object's Target instance be set like is done for call dispatching, as
well as the context class loading?  For call dispatching, the access control
context from export-time is set to make security checks occur for parameter
unmarshalling without skeletons, an issue not really relavent to unreferenced()
callbacks...]

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.2fcs FIXED IN: 1.2fcs INTEGRATED IN: 1.2fcs
14-06-2004

SUGGESTED FIX When a instance of sun.rmi.transport.Target creates a thread to invoke the unreferenced() method of the remote object that it refers to, it should set the context class loader of that thread to be the saved context class loader for the object in the Target's instance field "ccl".
11-06-2004

PUBLIC COMMENTS When a remote object's "unreferenced" method is invoked by the system, it is invoked in a separate thread created for that purpose which inherits its "context class loader" from the thread that created it, which may be a remote call dispatch thread (if the object's unreferenced state is due to the receipt of a DGC clean call) or the DGC lease checker thread (if it is due to an expired lease), which would, in turn, have inherited its "context class loader" from a remote call dispatch thread processing some previous DGC dirty call. In either case, the context class loader in effect when the remote object's unreferenced() code is invoked will be fairly arbitrary. Because of this, actions untaken during the execution of the unrefenreced() method that require the correct setting of the context class loader, such as the correct resolution of class in the return values of remote calls or the location of downloadable URL protocol handlers, will fail.
10-06-2004

EVALUATION Fixed and integrated for 1.2FCS-K. peter.jones@East 1998-09-14
14-09-1998