Re: Trouble writing a Factory



Bowie Owens wrote:

I've just added a test client and server that implements a really basic factory. It can be found under test/cpp/factory. It should be enough to get you started. You will have to check out the CVS version of orbitcpp to get at the example. Instructions on how to get the CVS version on the orbitcpp webpage.

http://orbitcpp.sourceforge.net/

The anonymous servers sometimes take time to sync. You'll need the version with a ChangeLog entry that reads as follows.

2004-12-08 Bowie Owens <bowie owens csiro au>
       * configure.in
       * test/cpp/Makfile.am
       * test/cpp/factory/Makefile.am
       * test/cpp/factory/client.cc
       * test/cpp/factory/factory-impl.cc
       * test/cpp/factory/factory-impl.h
       * test/cpp/factory/server.cc
       * test/cpp/factory/generated/Makefile.am:
       Quickly hacked together example of factory.

Please let me know if anything fails to work.

Well, with the following IDL it seem to work well , so thanks for that.

module Factory
{
   interface AbstractService
   {
       void doit (in string arg);
       void destroy ();
   } ;


   interface Producer
   {
     AbstractService produce (in string arg) ;
   } ;
} ;

The odd thing is that my version with your producer method exits on the client side with

** ERROR **: file orbit-object.c: line 149 (do_unref): assertion failed: (robj->refs < ORBIT_REFCOUNT_MAX && robj->refs > 0)

This is *really* odd, because as far as I can see my example is identical to yours. I'm going to investigate further, but with valgrind I see:

==2510== Invalid read of size 4
==2510== at 0x1BA2CC0E: ORBit_RootObject_release (in /usr/lib/libORBit-2.so.0
.0.0)
==2510==    by 0x1BA2B018: (within /usr/lib/libORBit-2.so.0.0.0)
==2510==    by 0x1BBBF19F: exit (in /lib/libc-2.3.4.so)
==2510==    by 0x1BBA9113: __libc_start_main (in /lib/libc-2.3.4.so)
==2510==    by 0x8048C20: (within /home/nickg/src/radar/bin/engine)
==2510==  Address 0x1BCE47E4 is 4 bytes inside a block of size 48 free'd
==2510==    at 0x1B9041B0: free (vg_replace_malloc.c:153)
==2510==    by 0x1BB10973: g_free (in /usr/lib/libglib-2.0.so.0.400.7)
==2510==    by 0x1BA2AF80: (within /usr/lib/libORBit-2.so.0.0.0)
==2510==    by 0x1BA2CB7D: (within /usr/lib/libORBit-2.so.0.0.0)
==2510== by 0x1BA2CC33: ORBit_RootObject_release (in /usr/lib/libORBit-2.so.0.0.0) ==2510== by 0x1BA2C794: CORBA_ORB_destroy (in /usr/lib/libORBit-2.so.0.0.0)
==2510==    by 0x1BA2B010: (within /usr/lib/libORBit-2.so.0.0.0)
==2510==    by 0x1BBBF19F: exit (in /lib/libc-2.3.4.so)
==2510==    by 0x1BBA9113: __libc_start_main (in /lib/libc-2.3.4.so)
==2510==    by 0x8048C20: (within /home/nickg/src/radar/bin/engine)
==2510==
==2510== Invalid read of size 4
==2510==    at 0x1BA2CB2A: (within /usr/lib/libORBit-2.so.0.0.0)
==2510== by 0x1BA2CC33: ORBit_RootObject_release (in /usr/lib/libORBit-2.so.0.0.0)
==2510==    by 0x1BA2B018: (within /usr/lib/libORBit-2.so.0.0.0)
==2510==    by 0x1BBBF19F: exit (in /lib/libc-2.3.4.so)
==2510==    by 0x1BBA9113: __libc_start_main (in /lib/libc-2.3.4.so)
==2510==    by 0x8048C20: (within /home/nickg/src/radar/bin/engine)
==2510==  Address 0x1BCE47E4 is 4 bytes inside a block of size 48 free'd
==2510==    at 0x1B9041B0: free (vg_replace_malloc.c:153)
==2510==    by 0x1BB10973: g_free (in /usr/lib/libglib-2.0.so.0.400.7)
==2510==    by 0x1BA2AF80: (within /usr/lib/libORBit-2.so.0.0.0)
==2510==    by 0x1BA2CB7D: (within /usr/lib/libORBit-2.so.0.0.0)
==2510== by 0x1BA2CC33: ORBit_RootObject_release (in /usr/lib/libORBit-2.so.0.0.0) ==2510== by 0x1BA2C794: CORBA_ORB_destroy (in /usr/lib/libORBit-2.so.0.0.0)
==2510==    by 0x1BA2B010: (within /usr/lib/libORBit-2.so.0.0.0)
==2510==    by 0x1BBBF19F: exit (in /lib/libc-2.3.4.so)
==2510==    by 0x1BBA9113: __libc_start_main (in /lib/libc-2.3.4.so)
==2510==    by 0x8048C20: (within /home/nickg/src/radar/bin/engine)

Even when I trim to client down to 'one line'

  CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

I see this assertion. I'm going to investigate whether its compile options of other libraries pulled in... (Also, our versions of orbitcpp could be different as one is emerged on gentoo, and the other came out of CVS)

Cheers,

Nick



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