Ticket #150 (closed defect: fixed)
Opened 11 years ago
Hierarchical DGC fails with localEnter error
| Reported by: | Brien Oberstein (brien dot oberstein at transacttools dot net) | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.07a |
| Component: | uka.karmi | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
When trying to look up an object from a registry that runs in the same virtual machine using an URL of the form "rmi://localhost/server-name", the call to Naming.lookup() fails with the following error message:
java.lang.UnsupportedOperationException
at uka.karmi.dgc.HierarchicalDGC$EnterContext.localEnter(
HierarchicalDGC.java:130)
at uka.karmi.rmi.SingleRemoteClientRef.readExternal(
SingleRemoteClientRef.java:354)
at uka.karmi.rmi.SingleRemoteClientRef.unmarshalReferences(
SingleRemoteClientRef.java:458)
at uka.transport.UnmarshalStream.readObject(
UnmarshalStream.java:318)
at uka.karmi.rmi.server.RemoteStub.unmarshalReferences(
RemoteStub.java:208)
at uka.transport.UnmarshalStream.readObject(
UnmarshalStream.java:318)
at uka.transport.MarshalContext.receiveObject(
MarshalContext.java:92)
at uka.karmi.registry.RegistryImpl_KStub.lookup(
RegistryImpl_KStub.java)
at uka.karmi.rmi.Naming.lookup(Naming.java:99)
The lookup (with the same URL) from another virtual machine running on the same host works fine.
Evaluation
The method localEnter() of the hierarchical garbage collector's enter context did throw unconditionally an UnsupportedOperationException. This was due to the following assumption:
A reference to a local object does not arrive at a virtual machine during "normal" operation. Passing a reference to a remote object to another machine always causes a bridge object to be created on the machine that passes the reference. This makes sure that a passed remote reference always points to an object that resides on the machine that passed the reference. When receiving a reference the referenced object can not be local.
This assumption is wrong, because under special circumstances a reference pointing to a local object may "enter" a virtual machine: When using an artificial reference (e.g. to the registry) to make a call to a server object that resides on the same local machine, the locality of this call can not be detected and all references passed along that call are marshaled and unmarshaled instead of being passed by reference. During the unmarshaling process of such a reference the localEnter() method is called, if the referenced object also resides on the local machine. Therefore this method should not throw an UnsupportedOperationException! See ticket:150.
Test
uka.karmi.test.TestBase -master -nodes 2 uka.karmi.test.TestBase -host localhost
fixed since 1.07a.
