[omniORB] omniORB 3/4 create_POA deadlocks

Teemu Torma tot@trema.com
Mon Oct 14 17:22:00 2002


--------------Boundary-00=_63CZJA4HR3PCWBFEJ0WZ
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Monday 14 October 2002 17:43, Duncan Grisby wrote:
> Thanks for discovering that and tracking the cause down. I've checked
> in a fix to omniORB 4's CVS. Does anyone think it's worth
> back-porting to omniORB 3?  It's a pretty obscure condition.

There is actually one scenario that might fail--if we are waiting for a=20
child to destruct and someone destroys us.  Since we do not hold any=20
locks at the time, we should probably also increment our ref count to=20
avoid any nasty problems. =20

Maybe something like the attached diff (completely untested) might help. =
=20
The diff is on top of my previous for omniORB3.

Teemu

--------------Boundary-00=_63CZJA4HR3PCWBFEJ0WZ
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="omniorb3-poa2.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="omniorb3-poa2.diff"

Index: src/lib/omniORB2/orbcore/poa.cc
===================================================================
RCS file: /trema/cvs/fk/tools/omniorb/src/lib/omniORB2/orbcore/Attic/poa.cc,v
retrieving revision 1.1.1.3.2.2
diff -c -u -r1.1.1.3.2.2 poa.cc
--- src/lib/omniORB2/orbcore/poa.cc	10 Oct 2002 21:35:25 -0000	1.1.1.3.2.2
+++ src/lib/omniORB2/orbcore/poa.cc	14 Oct 2002 16:19:08 -0000
@@ -418,6 +418,7 @@
   poa_lock.lock ();
   pd_lock.lock ();
   CORBA::Boolean locked = 1;
+  CORBA::Boolean release = 0;
 
   try {
     // If an adapter of the given name exists, but is in the
@@ -433,6 +434,9 @@
 
       if( p->pd_dying ) {
 
+	incrRefCount();
+	release = 1;
+
 	// Release other locks that we do not get deadlock
 	// during the possible destruction.
 	pd_lock.unlock ();
@@ -470,6 +474,11 @@
 
     CHECK_NOT_DYING();
 
+    if ( release ) {
+      decrRefCount();
+      release = 0;
+    }
+
     if( CORBA::is_nil(manager) )
       manager = new omniOrbPOAManager();
     else
@@ -501,6 +510,9 @@
     if( locked ) {
       pd_lock.unlock();
       poa_lock.unlock();
+    }
+    if( release ) {
+      decrRefCount();
     }
     throw;
   }

--------------Boundary-00=_63CZJA4HR3PCWBFEJ0WZ--