[omniORB] Bug found in omniORB2 version 6.1.
Bjorn Jorde
bjorde@tumbleweed.com
Mon, 21 Jun 1999 20:02:34 -0700
We discovered a problem in the HandleLocateRequest() in giopServer.cc.
The problem occurs when the loader returns a nil object reference.
This might be fixed in the latest release, but in case it is not,
here the fix.
When omni::locateObject() throws an exception OBJECT_NOT_EXIST, and
we have a MapKeyToObjectFunction that returns nil, the status will
not be initialized, and the invoker side will catch a COMM_FAILURE
rather than OBJECT_NOT_EXIST.
Here's the code with the fix:
try {
// In future, we have to partially decode the object key to
// determine which object manager it belongs to.
// For the moment, there is only one object manager-
rootObjectManager.
obj = omni::locateObject(omniObjectManager::root(),pd_objkey);
omni::objectRelease(obj);
status = GIOP::OBJECT_HERE;
}
catch (const CORBA::OBJECT_NOT_EXIST&) {
if (MapKeyToObjectFunction) {
// Cannot find the object in the object table. If the application
// has registered a loader, do an upcall to locate the object.
// If the return value is not a nil object reference, reply with
// OBJECT_FORWARD and the new object reference.
CORBA::Object_var newDestination =
MapKeyToObjectFunction(pd_objkey);
if (!CORBA::is_nil(newDestination)) {
status = GIOP::OBJECT_FORWARD;
WrLock();
pd_state = GIOP_S::ReplyIsBeingComposed;
size_t msgsize = sizeof(MessageHeader::LocateReply) + 4 + 8;
msgsize = CORBA::Object::NP_alignedSize(newDestination,msgsize);
msgsize = msgsize - sizeof(MessageHeader::LocateReply) - 4;
WrMessageSize(0);
put_char_array((CORBA::Char *)MessageHeader::LocateReply,
sizeof(MessageHeader::LocateReply),1,1);
operator>>= ((CORBA::ULong)msgsize,*this);
operator>>= (pd_request_id,*this);
operator>>= ((CORBA::ULong)status,*this);
CORBA::Object::marshalObjRef(newDestination,*this);
flush(1);
pd_state = GIOP_S::Idle;
WrUnlock();
} else {
status = GIOP::UNKNOWN_OBJECT;
}
}
else {
status = GIOP::UNKNOWN_OBJECT;
}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The three lines above are needed to set status correctly.
}
catch(...) {
status = GIOP::UNKNOWN_OBJECT;
}
--
Bjørn Jorde bjorn@tumbleweed.com
Senior Software Engineer (650)216-2028
Tumbleweed Software Corporation <http://www.tumbleweed.com>
"The worst poverty is not to live in a small house, but to live in a
small mind."
-Ralph Waldo Emerson