[omniORB] Problem with oneway methods and omniidl 4.0.0

Ilya Kreyer ilya@axiomsl.com
Mon Nov 18 22:50:01 2002


Hello,
  Recently we stumbled upon a problem with omniidl version 4.0.0 with 
generating proxies for oneway methods. The bug is as follows. Suppose we 
have an idl like this (Foo.idl):
interface Foo
{
     void bar();
     oneway void bar2();
};
  When compiled with omniidl with option -bcxx file FooSK.cc is being 
generated. Here's a couple of lines from there :
--------------------------------------------------------------------------
void _objref_Foo::bar()
{
   _0RL_cd_cf6ba5b8301d1c4e_00000000 
_call_desc(_0RL_lcfn_cf6ba5b8301d1c4e_30000000, "bar", 4);
   _invoke(_call_desc);
}
void _objref_Foo::bar2()
{
   _0RL_cd_cf6ba5b8301d1c4e_00000000 
_call_desc(_0RL_lcfn_cf6ba5b8301d1c4e_30000000, "bar2", 5);
   _invoke(_call_desc);
}
class _0RL_cd_cf6ba5b8301d1c4e_00000000
   : public omniCallDescriptor
{
public:
   inline _0RL_cd_cf6ba5b8301d1c4e_00000000(LocalCallFn lcfn,const char* 
op,size_t oplen,_CORBA_Boolean upcall=0):
      omniCallDescriptor(lcfn, op, oplen, 0, 0, 0, upcall) {}
};
--------------------------------------------------------------------------
  As you can see, both proxy methods use the same invocation class. 
Fourth parameter in call to constructor of omniCallDescriptor (being 
passed 0 in this case) stands for a flag indicating 'onewayness' of a 
method. Therefore, in this case both methods would be treated as not 
being oneway, disregarding oneway declaration for method bar2.
  If we make method bar oneway and method bar2 not oneway as follows:
interface Foo
{
     oneway void bar();
     void bar2();
};
  then the same code would be generated , except 4th parameter in call to
omniCallDescriptor would change to 1 and both methods would behave as 
oneway.
  Even more interestingly, the same would happen even if both methods 
would be in different interfaces like this :
interface Foo
{
     oneway void bar();
};
interface Foo1
{
     void bar2();
};
  Both methods would still be oneway.
  The only way to avoid this behavior is to change a signature of bar2 
or bar in example above , by either adding parameters, or declaring bar2 
as throwing exception or forcing bar2 to return some value. In this case 
  different proxy classes would be generated for both methods and they 
would have correct oneway parameters.
  To sum it all up, for all methods returning void, throwing no 
exceptions with the same arguments only one proxy class is being 
generated by omniidl and oneway attribute of that class would be the 
same as the oneway attribute of the first occurrence of such method in 
.idl file.
  Can anybody else confirm this behavior , I don't know if maybe this 
has been fixed already. Please let me know of all your thoughts/opinions 
on the subject.
         Thanks,
             Ilya Kreyer, Axiom Software Laboratories