Re: Help with core dump



Richard Andrews wrote:

--- Nick Glencross <nickg glencros demon co uk> wrote:
#6  0x401a6601 in CORBA_ORB_shutdown (orb=0x806c240,
   wait_for_completion=1 '\001', ev=0xbffff180) at corba-orb.c:1133
#7  0x401a669c in CORBA_ORB_destroy (orb=0x806c240, ev=0xbffff180)
   at corba-orb.c:1163
#8  0x401a52b2 in shutdown_orb () at corba-orb.c:255
#9  0x4034d1a0 in exit () from /lib/libc.so.6
#10 0x40337114 in __libc_start_main () from /lib/libc.so.6
#11 0x08052a61 in _start ()


Is atexit() registered to call shutdown_orb()? Looks like main() has
finished and atexit() is cleaning up.

The usual server pattern is for main() not to finish until _after_ the
ORB has been shut down.

I would suggest that shutdown_orb() is being called from two different
places, the second being via the atexit() function after main()
finishes. This could result in the second shutdown trying to deallocate
memory which is already deallocated.

If you can run the process in a debugger, I would put a breakpoint in
shutdown_orb() or downstream like ORBit_POA_deactivate() to see if this
stuff gets called twice.
I've sent a cut down example, but it's been held up because it was slightly too big. I've probably better off running through it in details.

In the client I've got:

... (Create Object pointers from IORs)
       ptr1->ping ();
       ptr2->ping ();

       ptr1->create_thread ();

       ptr1->submit_work (ptr2);

'ping' is just a test method. 'create_thread' creates a thread, and 'submit_work' causes the object 'ptr1' to submit the Object pointer 'ptr2' onto a queue for the thread which will call 'ping' on it when it picks it up.

To create the thread in 'create_thread', I've used glibmm:

Glib::Thread::create (sigc::mem_fun(this,
&server_thread::thread_consumer),
                                     true);

where the body of 'thread_consumer' is:

 // This is where each Thread spends its life
 while (1)
   {
     {
       Glib::Mutex::Lock lock (thread_mutex_);

       while (queue_.empty ())
       {
         activity_.wait (thread_mutex_);
       }

       Hello_ptr thread_work = queue_.front ();
       queue_.pop ();

       std::cerr << "Thread picked up work\n" ;

       // XXX: The call that kills things ...
       thread_work->ping ();
     }

   }
}


Then, when 'submit_work' is invoked, it submits the Object to the thread's queue:

thread->queue (hellomodule::Hello::_duplicate (ptr));

This will wake up 'thread_consumer', pick up the Object and invoke ping on it, which dies.

I suspect that I'm probably not doing the right thing in the thread. It IS possible to pass an Object address from one thread to another (with care), isn't it? Any thoughts appreciated,

Regards,

Nick Glencross



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