[omniORB] [bug][patch??] mutex problem in omniOrbBOA::destroy()

Tomasz Bech tbech at polbox.com
Fri Jul 25 11:37:53 BST 2003


Hi all,
I was playing a little bit with proper shutdown steps and found a bug 
(probably).
After boa->destroy the trace is telling me:
Assertion failed -- mutex should not be held.

Look for comments in following code started with 'tbech'

void
omniOrbBOA::destroy()
{

  // not important code

  // Remove all my objects from the object table.
  //tbech HERE - the LOCK
  omni::internalLock->lock();
  omniObjTableEntry* entry = obj_list;
  while( entry ) {
    while (entry->state() == omniObjTableEntry::ACTIVATING)
      entry->wait(omniObjTableEntry::ACTIVE |
          omniObjTableEntry::DEACTIVATING |
          omniObjTableEntry::ETHEREALISING);

    if (entry->state() == omniObjTableEntry::ACTIVE)
      entry->setDeactivating();

    entry = entry->nextInOAObjList();
  }

  // We need to kick anyone stuck in synchronise_request(),
  // or impl_is_ready().
  pd_state_signal->broadcast();

  // Wait until outstanding invocations have completed.
  waitForAllRequestsToComplete(1);

  entry = obj_list;
  while( entry ) {
    if (entry->state() == omniObjTableEntry::DEACTIVATING)
      entry->setEtherealising();

    OMNIORB_ASSERT(entry->is_idle());
    entry = entry->nextInOAObjList();
  }

  // Kill the identities, but not the servants themselves.
  // (See user's guide 5.4).
  entry = obj_list;
  while( entry ) {
    OMNIORB_ASSERT(entry->is_idle());

    omniObjTableEntry* next = entry->nextInOAObjList();
    entry->setDead();
    entry = next;
  }

  // Wait for objects which have been detached to complete
  // their etherealisations.

//tbech patch?!?!
  omni::internalLock->unlock();
//tbech patch?? end

  //tbech: HERE - wait_for_detached_objects() is expecting that there is 
no LOCK on omni::internalLock
  wait_for_detached_objects();

  adapterDestroyed();
  CORBA::release(boa);
}


So my patch is to call unlock first. But maybe 
wait_for_detached_objects() should have different assertion (that mutex 
must be held).
Developers know better. However this patch works fine for me.

    Tomasz
I've found the tracing in omniORB very usefull. I'm also using 
commercial CORBA (Visibroker), which lacks tracing a lot. I hope soon 
there will be only omniORB in my project, but still have several 
problems to fix during migrating to omniORB.





More information about the omniORB-list mailing list