Re: [orbitcpp-list] two rookie questions: initialization, object validation



Phil Dawes wrote:
> Perhaps more importanly, if the server has gone down, what
 > is the best way for the client to avoid hanging or crashing on
 > subsequent calls to that server?  Is there a way to validate
 > the object such as objectPointer->isWorking() or even
 > objectPointer->wontHang().  Perhaps I can embed and
 > catch an alarm signal before each client call.
 >

I'm not sure about this one. If orbit is unable to connect to the
server you get a CORBA::COMM_FAILURE system exception. However if
ORBit has previously connected to the server then you do seem to get a
hang. I'll do some experimenting over the weekend...

In trying to unbemuse myself how to use orbit in a fault-tolerant way on linux,
I've discovered where the client hangs when the server dies.  On any idl-defined
function call, the client permenantly hangs when calling
    'giop_recv_reply_buffer_use_2'
in the <name>-stubs.c file where it is apparently expecting to receive a reply
after having sent a write via:
    'giop_send_buffer_write'
where the write failed (but the error is not checked.

This hang can be avoided by checking 'errno' after 'giop_send_buffer_write'
then throwing an exception:

errno=0 ;       // lance
      giop_send_buffer_write(_ORBIT_send_buffer);
if (errno)      // lance
goto _ORBIT_system_exception;   // lance

which works well but needs to be part of orbit-idl's 'C'-code generation
(and has nothing to do with orbitcpp other than be used by it).

    ...  please standby while I download ORBit-0.5.5 ...

I've found the code that generates 'giop_recv_reply_buffer_use_2':

#ifdef BACKWARDS_COMPAT_0_4
  fprintf(ci->fh, "giop_send_buffer_write(_ORBIT_send_buffer);\n");
#else
  fprintf(ci->fh, "if(giop_send_buffer_write(_ORBIT_send_buffer)) goto _ORBIT_system_exception;\n");
#endif

Wow.  I love open source.  Gives me all sorts of new ways to spend
my Friday nights!  Now I change ./ORBit-0.5.5/src/orb/orbit.h.in:

/* #define BACKWARDS_COMPAT_0_4 */
/* #undef NOT_BACKWARDS_COMPAT_0_4 */
#undef BACKWARDS_COMPAT_0_4
#define NOT_BACKWARDS_COMPAT_0_4

followed by a 'make clean' and that almost works but alas that still
leaves ./ORBit-0.5.5/src/orbit-idl-compiler/backends/c/ which appears
to not be a generated file with a '#define BACKWARDS_COMPAT_0_4'.
Forcing that change, a remake and install should finally yield the desirable
results of generating a <name>-stubs.c file which checks the return
value of giop_send_buffer_write for an error and appropriately
throws an exception.  Ahh, but it doesn't - my previous orbit was
installed in '/usr' where this 'make install' went to '/usr/local'.
A quick run of './configure --prefix=/usr' and there's the fix!

Perhaps someone in the ORBit community can tell me how thin
the ground is when not defining 'BACKWARDS_COMPAT_0_4'?
Perhaps I should have simple made the modification locally to
orbit-idl-c-stubs.c rather then the sweeping undefine.

And I hope this is of use to someone else.  Thanks,  -Lance.

-- 
-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
Lance Welsh              lance seacoms com
Seascape Communications  (650) 327-6890
-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]