[OmniOrb] server lockup from connection close race condition

Jeremy Van Grinsven jeremvan at rocketmail.com
Fri Nov 19 16:44:26 GMT 2004


I attached the crude and nasty patch I used to fix the disconnect race condition.

There is also a patch to fix a string length issue with giop 1.0 principals.

Jeremy

Michal Misiaszek wrote:
> Dear Jeremy,
> I have the same problem with infinite loop in OmniOrb 4.0.5.
> http://www.omniorb-support.com/pipermail/omniorb-list/2004-March/025223.
> html Did you finally solved it ? I did not found the bug fix to this
> problem in new omniOrb release.
> I will appreciate any news regarding this problem.
> Best regards
> Michal Misiaszek
> 
> 
> 
> 
-------------- next part --------------
--- omniORB-4.0.3/include/omniORB4/internal/GIOP_S.h	Tue Nov 26 09:51:48 2002
+++ omniORB-src/include/omniORB4/internal/GIOP_S.h	Mon Aug 25 14:18:50 2003
@@ -196,6 +202,7 @@
     if (sz > GIOP_S_INLINE_BUF_SIZE) {
       pd_principal = new _CORBA_Octet[sz];
     }
+    pd_principal_len = sz;
   }
 
   //////////////////////////////////////////////////////////////////
-------------- next part --------------
diff -Pur omniORB-4.0.3/include/omniORB4/giopEndpoint.h omniORB-src/include/omniORB4/giopEndpoint.h
--- omniORB-4.0.3/include/omniORB4/giopEndpoint.h	Wed Aug 21 02:23:15 2002
+++ omniORB-src/include/omniORB4/giopEndpoint.h	Fri Oct  1 16:04:28 2004
@@ -94,13 +102,15 @@
 
 
   virtual void setSelectable(_CORBA_Boolean now = 0,
-			     _CORBA_Boolean data_in_buffer = 0) = 0;
+			     _CORBA_Boolean data_in_buffer = 0,
+                             omni_tracedmutex* server_lock = 0) = 0;
   // Indicates that this connection should be watched by a select()
   // so that any new data arriving on the connection will be noted.
   // If now == 1, immediately make this connection part of the select
   // set.
   // If data_in_buffer == 1, treat this connection as if there are
   // data available from the connection already.
+  // If server_lock != 0, use the lock to check dying status
 
 
   virtual void clearSelectable() = 0;
diff -Pur omniORB-4.0.3/src/lib/omniORB/orbcore/giopServer.cc omniORB-src/src/lib/omniORB/orbcore/giopServer.cc
--- omniORB-4.0.3/src/lib/omniORB/orbcore/giopServer.cc	Mon Oct 20 12:11:12 2003
+++ omniORB-src/src/lib/omniORB/orbcore/giopServer.cc	Fri Oct  1 16:04:31 2004
@@ -985,7 +993,7 @@
     }
     if (select_and_return) {
       // Connection is selectable now
-      conn->setSelectable(1);
+      conn->setSelectable(1,0,&pd_lock);
       return 0;
     }
 
@@ -1005,7 +1013,7 @@
     }
 
     // Connection is selectable now
-    conn->setSelectable(1);
+    conn->setSelectable(1,0,&pd_lock);
 
     // Worker is no longer needed.
     {
diff -Pur omniORB-4.0.3/src/lib/omniORB/orbcore/ssl/sslConnection.cc omniORB-src/src/lib/omniORB/orbcore/ssl/sslConnection.cc
--- omniORB-4.0.3/src/lib/omniORB/orbcore/ssl/sslConnection.cc	Wed Nov 12 11:04:17 2003
+++ omniORB-src/src/lib/omniORB/orbcore/ssl/sslConnection.cc	Fri Oct  1 16:04:34 2004
@@ -380,7 +388,8 @@
 /////////////////////////////////////////////////////////////////////////
 void
 sslConnection::setSelectable(CORBA::Boolean now,
-			     CORBA::Boolean data_in_buffer) {
+			     CORBA::Boolean data_in_buffer,
+                             omni_tracedmutex* server_lock) {
 
   if (SSL_pending(ssl_handle())) data_in_buffer = 1;
 
diff -Pur omniORB-4.0.3/src/lib/omniORB/orbcore/ssl/sslConnection.h omniORB-src/src/lib/omniORB/orbcore/ssl/sslConnection.h
--- omniORB-4.0.3/src/lib/omniORB/orbcore/ssl/sslConnection.h	Tue Jul 31 12:16:23 2001
+++ omniORB-src/src/lib/omniORB/orbcore/ssl/sslConnection.h	Fri Oct  1 16:04:34 2004
@@ -77,7 +85,9 @@
 
   const char* peeraddress();
 
-  void setSelectable(CORBA::Boolean now = 0,CORBA::Boolean data_in_buffer = 0);
+  void setSelectable(CORBA::Boolean now = 0,
+                     CORBA::Boolean data_in_buffer = 0,
+                     omni_tracedmutex* server_lock = 0);
 
   void clearSelectable();
 
diff -Pur omniORB-4.0.3/src/lib/omniORB/orbcore/tcp/tcpConnection.cc omniORB-src/src/lib/omniORB/orbcore/tcp/tcpConnection.cc
--- omniORB-4.0.3/src/lib/omniORB/orbcore/tcp/tcpConnection.cc	Wed Nov 12 11:04:17 2003
+++ omniORB-src/src/lib/omniORB/orbcore/tcp/tcpConnection.cc	Fri Oct  1 16:04:36 2004
@@ -78,6 +86,7 @@
   Big checkin with the brand new internal APIs.
 
 */
+#define private public
 
 #include <omniORB4/CORBA.h>
 #include <omniORB4/giopEndpoint.h>
@@ -363,9 +372,19 @@
 /////////////////////////////////////////////////////////////////////////
 void
 tcpConnection::setSelectable(CORBA::Boolean now,
-			     CORBA::Boolean data_in_buffer) {
+			     CORBA::Boolean data_in_buffer,
+                             omni_tracedmutex* server_lock) {
+  if ( server_lock ) {
+    omni_tracedmutex_lock fd_sync(pd_belong_to->pd_fdset_lock);
+    omni_tracedmutex_lock lock_sync(*server_lock);
 
-  pd_belong_to->setSelectable(pd_socket,now,data_in_buffer);
+    if ( !this->pd_dying ) {
+      pd_belong_to->setSelectable(pd_socket,now,data_in_buffer,1);
+    }
+  }
+  else {
+    pd_belong_to->setSelectable(pd_socket,now,data_in_buffer);
+  }
 }
 
 
diff -Pur omniORB-4.0.3/src/lib/omniORB/orbcore/tcp/tcpConnection.h omniORB-src/src/lib/omniORB/orbcore/tcp/tcpConnection.h
--- omniORB-4.0.3/src/lib/omniORB/orbcore/tcp/tcpConnection.h	Mon Dec  3 08:39:55 2001
+++ omniORB-src/src/lib/omniORB/orbcore/tcp/tcpConnection.h	Fri Oct  1 16:04:36 2004
@@ -80,7 +88,9 @@
 
   const char* peeraddress();
 
-  void setSelectable(CORBA::Boolean now = 0,CORBA::Boolean data_in_buffer = 0);
+  void setSelectable(CORBA::Boolean now = 0,
+                     CORBA::Boolean data_in_buffer = 0,
+                     omni_tracedmutex* server_lock = 0);
 
   void clearSelectable();
 
diff -Pur omniORB-4.0.3/src/lib/omniORB/orbcore/unix/unixConnection.cc omniORB-src/src/lib/omniORB/orbcore/unix/unixConnection.cc
--- omniORB-4.0.3/src/lib/omniORB/orbcore/unix/unixConnection.cc	Wed Nov 12 11:04:16 2003
+++ omniORB-src/src/lib/omniORB/orbcore/unix/unixConnection.cc	Fri Oct  1 16:04:42 2004
@@ -287,7 +295,8 @@
 /////////////////////////////////////////////////////////////////////////
 void
 unixConnection::setSelectable(CORBA::Boolean now,
-			     CORBA::Boolean data_in_buffer) {
+			     CORBA::Boolean data_in_buffer,
+                             omni_tracedmutex* server_lock) {
 
   pd_belong_to->setSelectable(pd_socket,now,data_in_buffer);
 }
diff -Pur omniORB-4.0.3/src/lib/omniORB/orbcore/unix/unixConnection.h omniORB-src/src/lib/omniORB/orbcore/unix/unixConnection.h
--- omniORB-4.0.3/src/lib/omniORB/orbcore/unix/unixConnection.h	Tue Aug  7 11:42:17 2001
+++ omniORB-src/src/lib/omniORB/orbcore/unix/unixConnection.h	Fri Oct  1 16:04:42 2004
@@ -64,7 +72,9 @@
 
   const char* peeraddress();
 
-  void setSelectable(CORBA::Boolean now = 0,CORBA::Boolean data_in_buffer = 0);
+  void setSelectable(CORBA::Boolean now = 0,
+                     CORBA::Boolean data_in_buffer = 0,
+                     omni_tracedmutex* server_lock = 0);
 
   void clearSelectable();
 


More information about the omniORB-list mailing list