[omniORB] omniORB4 bug: hang on shutdown with servant locator

Norrie Quinn norrie.quinn@tumbleweed.com
Thu Nov 7 01:32:00 2002


Hi,

We hit the following bug when a server using omniORB4 had several calls
in-progress during shutdown.  Once enterAdapter is called in
omniOrbPOA::dispatch_to_sl(), the corresponding exitAdapter() doesn't always
get called before omniOrbPOA::dispatch_to_sl() returns.  This causes the
shutdown thread to hang waiting for all calls to complete when a busy server
is shutdown.  The exception we saw causing this was
omniOrbPOA::synchronise_request() throwing during the shutdown process.  I
have included a possible fix for this below.

Regards
Norrie
_______________________________________________________________
Norrie Quinn                                       650 216 2533
Tumbleweed Communications Corp.     norrie.quinn@tumbleweed.com


RCS file: /cvsroot/omniorb/omni/src/lib/omniORB/orbcore/Attic/poa.cc,v
retrieving revision 1.2.2.34
diff -c -r1.2.2.34 poa.cc
*** poa.cc	14 Oct 2002 15:16:20 -0000	1.2.2.34
--- poa.cc	7 Nov 2002 01:06:35 -0000
***************
*** 3360,3375 ****
      OMNIORB_THROW(OBJ_ADAPTER, OBJ_ADAPTER_NoServant,
CORBA::COMPLETED_NO);
    }
  
!   omniLocalIdentity the_id(key, keysize,
  			   (PortableServer::Servant)servant, this);
  
!   // Create postinvoke hook
!   SLPostInvokeHook postinvokeHook(this, sl, oid, handle.operation_name(),
  				  cookie, servant);
!   handle.postinvoke_hook(&postinvokeHook);
  
!   omni::internalLock->lock();
!   the_id.dispatch(handle);
  }
  
  void
--- 3360,3382 ----
      OMNIORB_THROW(OBJ_ADAPTER, OBJ_ADAPTER_NoServant,
CORBA::COMPLETED_NO);
    }
  
!   try {
!     omniLocalIdentity the_id(key, keysize,
  			   (PortableServer::Servant)servant, this);
  
!     // Create postinvoke hook
!     SLPostInvokeHook postinvokeHook(this, sl, oid,
handle.operation_name(),
  				  cookie, servant);
!     handle.postinvoke_hook(&postinvokeHook);
! 
!     omni::internalLock->lock();
!     the_id.dispatch(handle);
  
!     exitAdapter();
!   } catch (...) {
!       exitAdapter();
!       throw;
!   }
  }
  
  void
***************
*** 3379,3394 ****
  {
    ASSERT_OMNI_TRACEDMUTEX_HELD(*omni::internalLock, 0);
  
!   try {
!     pd_sl->postinvoke(pd_oid, pd_poa, pd_op, pd_cookie, pd_servant);
!   }
!   catch (...) {
!     pd_poa->exitAdapter();
!     throw;
!   }
!   pd_poa->exitAdapter();
  }
- 
  
  omniOrbPOA*
  omniOrbPOA::attempt_to_activate_adapter(const char* name)
--- 3386,3393 ----
  {
    ASSERT_OMNI_TRACEDMUTEX_HELD(*omni::internalLock, 0);
  
!   pd_sl->postinvoke(pd_oid, pd_poa, pd_op, pd_cookie, pd_servant);
  }
  
  omniOrbPOA*
  omniOrbPOA::attempt_to_activate_adapter(const char* name)