view patches/openjdk/6980681-corba_deadlock.patch @ 2946:407a06b6d350

S7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8 S6763340: memory leak in com.sun.corba.se.* classes S6873605: Missing finishedDispatch() call in ORBImpl causes test failures after 5u20 b04 S6980681: CORBA deadlock in Java SE believed to be related to CR 6238477 2012-10-30 Andrew John Hughes <gnu.andrew@redhat.com> * Makefile.am: Add new patches. * NEWS: List new backports. * patches/openjdk/6763340-corba_memory_leak.patch, * patches/openjdk/6980681-corba_deadlock.patch, * patches/openjdk/7162902-corba_fixes.patch: Add a series of CORBA backports, already applied to the proprietary JDK6 release. * patches/traceable.patch: Fix GenerateBreakIteratorData tool so that crashes have stack traces.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Mon, 20 Jan 2014 07:16:23 +0000
parents
children
line wrap: on
line source

diff -Nru openjdk.orig/corba/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java openjdk/corba/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
--- openjdk.orig/corba/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java	2012-10-30 14:11:07.206514499 +0000
+++ openjdk/corba/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java	2012-10-30 14:12:01.291393721 +0000
@@ -245,7 +245,14 @@
     // All access to resolver, localResolver, and urlOperation must be protected using
     // resolverLock.  Do not hold the ORBImpl lock while accessing
     // resolver, or deadlocks may occur.
-    private Object resolverLock ;
+    // Note that we now have separate locks for each resolver type.  This is due
+    // to bug 6980681 and 6238477, which was caused by a deadlock while resolving a
+    // corbaname: URL that contained a reference to the same ORB as the
+    // ORB making the call to string_to_object.  This caused a deadlock between the
+    // client thread holding the single lock for access to the urlOperation,
+    // and the server thread handling the client is_a request waiting on the
+    // same lock to access the localResolver.
+
 
     // Used for resolver_initial_references and list_initial_services
     private Resolver resolver ;
@@ -255,8 +262,14 @@
 
     // Converts strings to object references for resolvers and string_to_object
     private Operation urlOperation ;
+    private final Object urlOperationLock = new java.lang.Object() ;
 
     private CorbaServerRequestDispatcher insNamingDelegate ;
+    // resolverLock must be used for all access to either resolver or
+    // localResolver, since it is possible for the resolver to indirectly
+    // refer to the localResolver.  Also used to protect access to
+    // insNamingDelegate.
+    private final Object resolverLock = new Object() ;
 
     private TaggedComponentFactoryFinder taggedComponentFactoryFinder ;
 
@@ -396,7 +409,6 @@
             }
         };
 
-        resolverLock = new java.lang.Object() ;
 
         requestDispatcherRegistry = new RequestDispatcherRegistryImpl(
             this, ORBConstants.DEFAULT_SCID);
@@ -832,7 +844,7 @@
         if (str == null)
             throw wrapper.nullParam() ;
 
-        synchronized (resolverLock) {
+        synchronized (urlOperationLock) {
             org.omg.CORBA.Object obj = (org.omg.CORBA.Object)op.operate( str ) ;
             return obj ;
         }
@@ -1778,7 +1790,7 @@
      */
     public void setURLOperation( Operation stringToObject )
     {
-        synchronized (resolverLock) {
+        synchronized (urlOperationLock) {
             urlOperation = stringToObject ;
         }
     }
@@ -1788,7 +1800,7 @@
      */
     public Operation getURLOperation()
     {
-        synchronized (resolverLock) {
+        synchronized (urlOperationLock) {
             return urlOperation ;
         }
     }