Discussion:
[omniORB] resolve() and _remote_non_existent()
smitha smi
2012-12-12 13:20:20 UTC
Permalink
Hi,


Below is the sequence of calls i make.

(1) o_ObjRef = rootContext->resolve(name);

This call is success as it is not throwing any exception.

(2)

try {

ServerReady_var l_readyObjRef = ServerReady::_narrow(o_ObjRef);

// Note: _is_nil call does not result in IPC

if (l_readyObjRef->_is_nil())

{

printf(" sink w/ server _narrow returned NIL");

break;

}

omniORB::setClientCallTimeout(

l_readyObjRef,15);

if(l_readyObjRef->_remote_non_existent())

{

printf("\n _remote_non_existent returned true\n");

}

}

catch (...)

{

printf("\n _remote_non_existent() threw an exception\n");

}

Result of execution of this code is : "_remote_non_existent() threw an
exception"

Below are my concerns

(a) What is the difference between resolve() and _remote_non_existent() ?

(b) After successfully getting the object reference by calling resolve() ,
why show we make call to remote_non_existent() ?

(c) By searching i got to the below info

_CORBA_Boolean _remote_non_existent();

1.199 + // Contacts to object implementation to determine whether it exists.

1.200 + // It is possible that the implementation is a local servant of
course.

1.201 + // Returns 0 if the object exists, or 1 or throws OBJECT_NOT_EXIST
if

1.202 + // not. May throw other system exceptions.

1.203 + // This function is thread-safe.

If Object was not existing, then resolve() it self should have thrown
exception. but , it did not throw any exception Why?

Fact is that , Before this code gets executed.. Object is been registered
with Naming Service.

Please help me understand , what is happening.

Thanks,

Smitha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20121212/f4a5e9eb/attachment.html>
Duncan Grisby
2012-12-21 14:22:53 UTC
Permalink
Post by smitha smi
Below is the sequence of calls i make.
(1) o_ObjRef = rootContext->resolve(name);
This call is success as it is not throwing any exception.
That call talks to omniNames and resolves the name to an object
reference. omniNames doesn't know or care whether the object reference
is valid.
Post by smitha smi
try {
ServerReady_var l_readyObjRef = ServerReady::_narrow(o_ObjRef);
That uses static knowledge to compare the expected interface with the
interface details stored in the object reference. In this case, it does
not need to do a remote call.
Post by smitha smi
// Note: _is_nil call does not result in IPC
if (l_readyObjRef->_is_nil())
_is_nil() never does a remote call. It is comparing the object reference
to nil, which is a purely local operation. An object reference is only
nil if it is nil. It has nothing to do with whether the object exists or
not.

[...]
Post by smitha smi
if(l_readyObjRef->_remote_non_existent())
You shouldn't call _remote_non_existent -- that is an internal omniORB
implementation detail. You should call _non_existent, which is the
standard method.

[...]
Post by smitha smi
catch (...)
{
printf("\n _remote_non_existent() threw an exception\n");
}
[...]
Post by smitha smi
Result of execution of this code is : "_remote_non_existent() threw an
exception"
If you catch CORBA::SystemException, you'll be able to call _name() on
it and you'll see what the exception was.

_non_existent contacts the server and asks if the object exists. It can
throw system exceptions like CORBA::TRANSIENT or CORBA::COMM_FAILURE if
the server cannot be contacted. If the server can be contacted but the
object does not exist, _non_existent will return true. omniORB's
internal _remote_non_existent will throw CORBA::OBJECT_NOT_EXIST.
Post by smitha smi
(a) What is the difference between resolve() and
_remote_non_existent() ?
They are totally unrelated. resolve() is an operation on the naming
service that looks up a name. _non_existent is about checking the
existence of an object.
Post by smitha smi
(b) After successfully getting the object reference by calling
resolve() , why show we make call to remote_non_existent() ?
You shouldn't call _remote_non_existent! You could choose to call
_non_existent if you want to make an initial check for object existence.

[...]
Post by smitha smi
If Object was not existing, then resolve() it self should have thrown
exception. but , it did not throw any exception Why?
resolve() looks up an object in the naming service. The naming service
doesn't care at all whether the object references it contains are valid
or not.

Regards,

Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
smitha smi
2013-01-21 16:10:45 UTC
Permalink
Hi,

Thanks for the info.

Below are few more concerns.

(1)
What exactly is the difference between

_remote_non_existent and _non_existent ?

(2)
We have been using : _remote_non_existent: from past many years and only
now we are seeing the issue.

In there any possibility that, _remote_non_existent will throw an exception
and _non_existent will return false?

(3)
As it involves lot of testing and jestification we need to give for
replacing _remote_non_existent() with _non_existent() we need to prove
that (2) is there any way i can recreate an issue suce that
"_remote_non_existent() " will throw an exception and _non_existent()
will return false.?

Please help us in this regard.

Thanks,
Smitha
Post by Duncan Grisby
Post by smitha smi
Below is the sequence of calls i make.
(1) o_ObjRef = rootContext->resolve(name);
This call is success as it is not throwing any exception.
That call talks to omniNames and resolves the name to an object
reference. omniNames doesn't know or care whether the object reference
is valid.
Post by smitha smi
try {
ServerReady_var l_readyObjRef = ServerReady::_narrow(o_ObjRef);
That uses static knowledge to compare the expected interface with the
interface details stored in the object reference. In this case, it does
not need to do a remote call.
Post by smitha smi
// Note: _is_nil call does not result in IPC
if (l_readyObjRef->_is_nil())
_is_nil() never does a remote call. It is comparing the object reference
to nil, which is a purely local operation. An object reference is only
nil if it is nil. It has nothing to do with whether the object exists or
not.
[...]
Post by smitha smi
if(l_readyObjRef->_remote_non_existent())
You shouldn't call _remote_non_existent -- that is an internal omniORB
implementation detail. You should call _non_existent, which is the
standard method.
[...]
Post by smitha smi
catch (...)
{
printf("\n _remote_non_existent() threw an exception\n");
}
[...]
Post by smitha smi
Result of execution of this code is : "_remote_non_existent() threw an
exception"
If you catch CORBA::SystemException, you'll be able to call _name() on
it and you'll see what the exception was.
_non_existent contacts the server and asks if the object exists. It can
throw system exceptions like CORBA::TRANSIENT or CORBA::COMM_FAILURE if
the server cannot be contacted. If the server can be contacted but the
object does not exist, _non_existent will return true. omniORB's
internal _remote_non_existent will throw CORBA::OBJECT_NOT_EXIST.
Post by smitha smi
(a) What is the difference between resolve() and
_remote_non_existent() ?
They are totally unrelated. resolve() is an operation on the naming
service that looks up a name. _non_existent is about checking the
existence of an object.
Post by smitha smi
(b) After successfully getting the object reference by calling
resolve() , why show we make call to remote_non_existent() ?
You shouldn't call _remote_non_existent! You could choose to call
_non_existent if you want to make an initial check for object existence.
[...]
Post by smitha smi
If Object was not existing, then resolve() it self should have thrown
exception. but , it did not throw any exception Why?
resolve() looks up an object in the naming service. The naming service
doesn't care at all whether the object references it contains are valid
or not.
Regards,
Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20130121/9dde8821/attachment.html>
Duncan Grisby
2013-01-23 19:02:11 UTC
Permalink
Post by smitha smi
(1)
What exactly is the difference between
_remote_non_existent and _non_existent ?
As I said in my original email, _non_existent is the standard method.
_remote_non_existent is an omniORB implementation detail. It may be
changed or removed in a future version.

If an object does not exist, _non_existent returns true;
_remote_non_existent throws CORBA::OBJECT_NOT_EXIST.
Post by smitha smi
(2)
We have been using : _remote_non_existent: from past many years and
only now we are seeing the issue.
In there any possibility that, _remote_non_existent will throw an
exception and _non_existent will return false?
I can't think of a situation off-hand where _non_existent will return
false, but it might happen with some pseudo object references like
CORBA::Policy. Or it could happen with a normal object reference that is
used after it is released if you were unlucky about memory reuse.

Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
Loading...