[omniORB] Using Any

Steven W Brenneis brenneis@surry.net
Wed, 03 Mar 1999 19:29:26 -0500


I have been experiencing a problem with the CORBA::Any class on omniORB =
2.7.0 (all patches applied), and was wondering if anyone else has seen =
similar.  This may or may not be related to Judy Anderson's post a =
couple of days ago.

The problem comes when a CORBA::Any, which has any one of a number of =
variant data structures marshalled into it, is assign to another =
CORBA::Any.  The symptoms from the outside are that the client receiving =
the Any will encounter invalid TypeCode information when marshalling out =
the data structure.  An exception is thrown causing the client to =
terminate the function and, if the data structures are large (> 8192 =
bytes of combined data and TypeCode), the server will experience a =
CORBA::COMM_FAILURE (due to the closed pipe).

It has been verified that the sending application has properly =
marshalled the data into the original Any, but when that Any is assigned =
to another for sending to the client, the typecode information is =
incomplete.

I have spent hours going through the code and it is very difficult to =
follow because of the heavily recursive nature of the TypeCode parser.  =
I have narrowed the problem down to the fact that the underlying AnyP =
class and the TypeCode parser share references to the same =
MemBufferedStream.  If the data structure which is being marshalled into =
the Any also contains complex structures (i.e. sequences, other Any's, =
etc.), the recipient Any uses the cached parameter list from the =
contained TypeCode parser.  Apparently the recipient MemBuffered Stream =
is not being copied from the original cached parameter list, but instead =
is simply being re-allocated on the heap.  This does not happen =
consistently and the nesting level of the contained structures must be =
deep.

Clear as mud, right?  As I said, this is heavily recursive code so the =
above explanation may not be correct, but hopefully close enough in case =
someone else has seen similar.=20

Steve Brenneis