United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6486322 org.omg.CORBA.ORB.init() thread safety issue
JDK-6486322 : org.omg.CORBA.ORB.init() thread safety issue

Details
Type:
Bug
Submit Date:
2006-10-25
Status:
Closed
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2008-01-14
Component:
other-libs
OS:
generic
Sub-Component:
corba:orb
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:
6u1 (b01)

Related Reports
Backport:
Backport:

Sub Tasks

Description
>They claim to uncover a thread safety issue in our implementation of org.omg.CORBA.ORB.init(). 
>Is this method is not intended to be thread-safe (it is not documented as such)? 
>or is it OMG's problem?
>    
>

This one is a bit interesting.  First, org.omg.CORBA.ORB.init() has
been unchanged for probably 8 years.  Most likely the reason for
not synchronizing it was that at the time (note that this code
was created and maintained by the OMG, not by Sun) someone 
decided that they did not want the overhead of synchronization
every time they wanted to get the ORB singleton.  Probably
a case of premature (and mistaken) optimization.

I think it would make sense
to synchronize it, simply to avoid the possibility that multiple
ORB singletons could be created, with only one getting assigned to
the singleton data member.  But that's not the cause of the
reported problem.

The method ORBSingleton.getFullORB is synchronized, as it should be,
but unfortunately the private ORBSingleton.fullORB is declared 
static.  getFullORB is synchronized at the instance level, so
creating multiple ORBSingleton instances in separate threads can
result in two or more threads concurrently executing
fullORB.set_parameters on the same instance assigned to the 
fullORB static data member, which can result in the reported behavior.

The fix is simple: make ORBSingleton.fullORB non-static.  It
would also be a good idea to synchronize the org.omg.CORBA.ORB.init()
method.  Please open a bug for this issue.

Thanks,

Ken.


  

> 
>The attached mail shows traceback and a code fragment from the ORB.init() source from jdk1.4.2_08 release, 
>but I believe 1.4.1 and 1.5.0_02 has the same code. 
>
>Please let me know any suggestions/comments you have.
>
>thanks in advance,
>Raghu
>
>
>______________________________________________________________________
>
><html>
><head>
><title>RE: IOP01210227: (BAD_OPERATION) Error in running ORB configurator</title>
><link rel="important stylesheet" href="chrome://messenger/skin/messageBody.css">
></head>
><body>
><table border=0 cellspacing=0 cellpadding=0 width="100%" class="header-part1"><tr><td><div class="headerdisplayname" style="display:inline;">Subject: </div>RE: IOP01210227: (BAD_OPERATION) Error in running ORB configurator</td></tr><tr><td><div class="headerdisplayname" style="display:inline;">From: </div>Biff Beers &lt;###@###.###&gt;</td></tr><tr><td><div class="headerdisplayname" style="display:inline;">Date: </div>Thu, 08 Dec 2005 22:58:57 -0500</td></tr></table><table border=0 cellspacing=0 cellpadding=0 width="100%" class="header-part2"><tr><td><div class="headerdisplayname" style="display:inline;">To: </div>Ed Burnette &lt;###@###.###&gt;, Joe Mudd &lt;###@###.###&gt;</td></tr></table><br>
><div class="moz-text-plain" wrap=true graphical-quote=true style="font-family: -moz-fixed; font-size: 13px;" lang="x-western"><pre wrap> Actually there is a rather glaringly obvious thread safety issue in Sun's implementation of org.omg.CORBA.ORB.init(). See if you can find it...
>
>    public static ORB init() {
>        if (singleton == null) {
>            String className = getSystemProperty(ORBSingletonClassKey);
>            if (className == null)
>                className = getPropertyFromFile(ORBSingletonClassKey);
>            if (className == null)
>                className = defaultORBSingleton;
>
>            singleton = create_impl(className);
>        }
>	return singleton;
>    }
>
>I'll see if Sun is interested in fixing this. Perhaps it is not intended to be thread-safe. While we wait for an answer, here is a build of sas.svc.connection.jar that attempts to work around the problem. Give it a try if you have a chance.
>
>\\sashq\root\u\sasbfb\Dev\eclipse\svc.connection.920.002\stage\debug\lib
>
>-----Original Message-----
>From: Biff Beers 
>Sent: Thursday, December 08, 2005 10:09 PM
>To: Ed Burnette; Joe Mudd
>Subject: RE: IOP01210227: (BAD_OPERATION) Error in running ORB configurator
>
>does "multiple users" mean multiple _concurrent_ users? Smells a little like a thread safety issue in org.omg.CORBA.ORB.init(). What JDK version are you using?
>
>-----Original Message-----
>From: Ed Burnette
>Sent: Thursday, December 08, 2005 9:05 AM
>To: Joe Mudd; Biff Beers
>Subject: IOP01210227: (BAD_OPERATION) Error in running ORB configurator
>
>Does this traceback mean anything to you? I get this about 10% of the time when I try to connect to the Olap server from my Java client with multiple users. Usually if I try the exact same thing a second time it works, although sometimes it takes two or three tries. Can you tell from this if I'm doing something wrong?
>
>
>20051206:17.09.52.627: Java Test Tool V9.2.1.x (playpen)
>20051206:17.09.52.642: Waiting for server to come up on host localhost port 9131...
>20051206:17.10.05.705: [Vuser 2] started
>20051206:17.10.05.705: [Vuser 1] started Dec 6, 2005 5:10:06 PM com.sun.corba.se.impl.orb.ORBImpl postInit
>WARNING: "IOP01210227: (BAD_OPERATION) Error in running ORB configurator"
>org.omg.CORBA.BAD_OPERATION:   vmcid: SUN  minor code: 227  completed: No
>	at com.sun.corba.se.impl.logging.ORBUtilSystemException.orbConfiguratorError(ORBUtilSystemException.java:558)
>	at com.sun.corba.se.impl.logging.ORBUtilSystemException.orbConfiguratorError(ORBUtilSystemException.java:576)
>	at com.sun.corba.se.impl.orb.ORBImpl.postInit(ORBImpl.java:485)
>	at com.sun.corba.se.impl.orb.ORBImpl.set_parameters(ORBImpl.java:524)
>	at com.sun.corba.se.impl.orb.ORBSingleton.getFullORB(ORBSingleton.java:437)
>	at com.sun.corba.se.impl.orb.ORBSingleton.getORBData(ORBSingleton.java:616)
>	at com.sun.corba.se.spi.orb.ORB.getLogger(ORB.java:419)
>	at com.sun.corba.se.spi.orb.ORB.getLogWrapper(ORB.java:465)
>	at com.sun.corba.se.impl.logging.ORBUtilSystemException.get(ORBUtilSystemException.java:54)
>	at com.sun.corba.se.spi.orb.ORB.&lt;init&gt;(ORB.java:234)
>	at com.sun.corba.se.impl.orb.ORBSingleton.&lt;init&gt;(ORBSingleton.java:119)
>	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>	at java.lang.Class.newInstance0(Class.java:350)
>	at java.lang.Class.newInstance(Class.java:303)
>	at org.omg.CORBA.ORB.create_impl(ORB.java:295)
>	at org.omg.CORBA.ORB.init(ORB.java:283)
>	at com.sas.iom.orb.ORBBase.get_primitive_tc(ORBBase.java:225)
>	at com.sas.iom.orb.AnyImpl.&lt;init&gt;(AnyImpl.java:61)
>	at com.sas.iom.orb.ORBBase.create_any(ORBBase.java:396)
>	at com.sas.iom.orb.brg.Engine.flowSendAuth(Engine.java:2207)
>	at com.sas.iom.orb.brg.Engine.flow(Engine.java:571)
>	at com.sas.iom.orb.brg.Engine.initClient(Engine.java:323)
>	at com.sas.iom.orb.brg.ORBImpl.uri_to_object(ORBImpl.java:104)
>	at com.sas.services.connection.ClusterEnvelope.createObject(ClusterEnvelope.java:134)
>	at com.sas.services.connection.ClusterEnvelope.getConnection(ClusterEnvelope.java:47)
>	at com.sas.services.connection.AggregationKernel.getConnection(AggregationKernel.java:163)
>	at com.sas.services.connection.ConnectionFactoryShell.getConnection(ConnectionFactoryShell.java:56)
>	at com.sas.services.connection.ConnectionFactoryShell.getConnection(ConnectionFactoryShell.java:39)
>	at com.sas.tools.testdriver.Context.makeConnection(Context.java:1372)
>	at com.sas.tools.testdriver.Context.reConnect(Context.java:420)
>	at com.sas.tools.testdriver.JTestThread.run(JTestThread.java:38)
>Caused by: org.omg.CORBA.BAD_PARAM: Tried to register duplicate service context  vmcid: 0x0  minor code: 0  completed: No
>	at com.sun.corba.se.spi.servicecontext.ServiceContextRegistry.register(ServiceContextRegistry.java:54)
>	at com.sun.corba.se.impl.orb.ORBConfiguratorImpl.initServiceContextRegistry(ORBConfiguratorImpl.java:428)
>	at com.sun.corba.se.impl.orb.ORBConfiguratorImpl.configure(ORBConfiguratorImpl.java:134)
>	at com.sun.corba.se.impl.orb.ORBImpl.postInit(ORBImpl.java:483)
>	... 31 more
>Dec 6, 2005 5:10:06 PM com.sas.services.connection.ClusterEnvelope getConnection
>SEVERE: new connection failed:
>org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation com.sun.corba.se.impl.orb.ORBSingleton  vmcid: 0x0  minor code: 0  completed: No
>	at org.omg.CORBA.ORB.create_impl(ORB.java:297)
>	at org.omg.CORBA.ORB.init(ORB.java:283)
>	at com.sas.iom.orb.ORBBase.get_primitive_tc(ORBBase.java:225)
>	at com.sas.iom.orb.AnyImpl.&lt;init&gt;(AnyImpl.java:61)
>	at com.sas.iom.orb.ORBBase.create_any(ORBBase.java:396)
>	at com.sas.iom.orb.brg.Engine.flowSendAuth(Engine.java:2207)
>	at com.sas.iom.orb.brg.Engine.flow(Engine.java:571)
>	at com.sas.iom.orb.brg.Engine.initClient(Engine.java:323)
>	at com.sas.iom.orb.brg.ORBImpl.uri_to_object(ORBImpl.java:104)
>	at com.sas.services.connection.ClusterEnvelope.createObject(ClusterEnvelope.java:134)
>	at com.sas.services.connection.ClusterEnvelope.getConnection(ClusterEnvelope.java:47)
>	at com.sas.services.connection.AggregationKernel.getConnection(AggregationKernel.java:163)
>	at com.sas.services.connection.ConnectionFactoryShell.getConnection(ConnectionFactoryShell.java:56)
>	at com.sas.services.connection.ConnectionFactoryShell.getConnection(ConnectionFactoryShell.java:39)
>	at com.sas.tools.testdriver.Context.makeConnection(Context.java:1372)
>	at com.sas.tools.testdriver.Context.reConnect(Context.java:420)
>	at com.sas.tools.testdriver.JTestThread.run(JTestThread.java:38)
>Caused by: org.omg.CORBA.BAD_OPERATION:   vmcid: SUN  minor code: 227  completed: No
>	at com.sun.corba.se.impl.logging.ORBUtilSystemException.orbConfiguratorError(ORBUtilSystemException.java:558)
>	at com.sun.corba.se.impl.logging.ORBUtilSystemException.orbConfiguratorError(ORBUtilSystemException.java:576)
>	at com.sun.corba.se.impl.orb.ORBImpl.postInit(ORBImpl.java:485)
>	at com.sun.corba.se.impl.orb.ORBImpl.set_parameters(ORBImpl.java:524)
>	at com.sun.corba.se.impl.orb.ORBSingleton.getFullORB(ORBSingleton.java:437)
>	at com.sun.corba.se.impl.orb.ORBSingleton.getORBData(ORBSingleton.java:616)
>	at com.sun.corba.se.spi.orb.ORB.getLogger(ORB.java:419)
>	at com.sun.corba.se.spi.orb.ORB.getLogWrapper(ORB.java:465)
>	at com.sun.corba.se.impl.logging.ORBUtilSystemException.get(ORBUtilSystemException.java:54)
>	at com.sun.corba.se.spi.orb.ORB.&lt;init&gt;(ORB.java:234)
>	at com.sun.corba.se.impl.orb.ORBSingleton.&lt;init&gt;(ORBSingleton.java:119)
>	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>	at java.lang.Class.newInstance0(Class.java:350)
>	at java.lang.Class.newInstance(Class.java:303)
>	at org.omg.CORBA.ORB.create_impl(ORB.java:295)
>	... 16 more
>Caused by: org.omg.CORBA.BAD_PARAM: Tried to register duplicate service context  vmcid: 0x0  minor code: 0  completed: No
>	at com.sun.corba.se.spi.servicecontext.ServiceContextRegistry.register(ServiceContextRegistry.java:54)
>	at com.sun.corba.se.impl.orb.ORBConfiguratorImpl.initServiceContextRegistry(ORBConfiguratorImpl.java:428)
>	at com.sun.corba.se.impl.orb.ORBConfiguratorImpl.configure(ORBConfiguratorImpl.java:134)
>	at com.sun.corba.se.impl.orb.ORBImpl.postInit(ORBImpl.java:483)
>	... 31 more
>Dec 6, 2005 5:10:06 PM com.sas.services.connection.ClusterEnvelope getConnection
>SEVERE: new connection failed:
>org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation com.sun.corba.se.impl.orb.ORBSingleton  vmcid: 0x0  minor code: 0  completed: No
>	at org.omg.CORBA.ORB.create_impl(ORB.java:297)
>	at org.omg.CORBA.ORB.init(ORB.java:283)
>	at com.sas.iom.orb.ORBBase.get_primitive_tc(ORBBase.java:225)
>	at com.sas.iom.orb.AnyImpl.&lt;init&gt;(AnyImpl.java:61)
>	at com.sas.iom.orb.ORBBase.create_any(ORBBase.java:396)
>	at com.sas.iom.orb.brg.Engine.flowSendAuth(Engine.java:2207)
>	at com.sas.iom.orb.brg.Engine.flow(Engine.java:571)
>	at com.sas.iom.orb.brg.Engine.initClient(Engine.java:323)
>	at com.sas.iom.orb.brg.ORBImpl.uri_to_object(ORBImpl.java:104)
>	at com.sas.services.connection.ClusterEnvelope.createObject(ClusterEnvelope.java:134)
>	at com.sas.services.connection.ClusterEnvelope.getConnection(ClusterEnvelope.java:47)
>	at com.sas.services.connection.AggregationKernel.getConnection(AggregationKernel.java:163)
>	at com.sas.services.connection.ConnectionFactoryShell.getConnection(ConnectionFactoryShell.java:56)
>	at com.sas.services.connection.ConnectionFactoryShell.getConnection(ConnectionFactoryShell.java:39)
>	at com.sas.tools.testdriver.Context.makeConnection(Context.java:1372)
>	at com.sas.tools.testdriver.Context.reConnect(Context.java:420)
>	at com.sas.tools.testdriver.JTestThread.run(JTestThread.java:38)
>Caused by: org.omg.CORBA.BAD_OPERATION:   vmcid: SUN  minor code: 227  completed: No
>	at com.sun.corba.se.impl.logging.ORBUtilSystemException.orbConfiguratorError(ORBUtilSystemException.java:558)
>	at com.sun.corba.se.impl.logging.ORBUtilSystemException.orbConfiguratorError(ORBUtilSystemException.java:576)
>	at com.sun.corba.se.impl.orb.ORBImpl.postInit(ORBImpl.java:485)
>	at com.sun.corba.se.impl.orb.ORBImpl.set_parameters(ORBImpl.java:524)
>	at com.sun.corba.se.impl.orb.ORBSingleton.getFullORB(ORBSingleton.java:437)
>	at com.sun.corba.se.impl.orb.ORBSingleton.getORBData(ORBSingleton.java:616)
>	at com.sun.corba.se.spi.orb.ORB.getLogger(ORB.java:419)
>	at com.sun.corba.se.spi.orb.ORB.getLogWrapper(ORB.java:465)
>	at com.sun.corba.se.impl.logging.ORBUtilSystemException.get(ORBUtilSystemException.java:54)
>	at com.sun.corba.se.spi.orb.ORB.&lt;init&gt;(ORB.java:234)
>	at com.sun.corba.se.impl.orb.ORBSingleton.&lt;init&gt;(ORBSingleton.java:119)
>	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>	at java.lang.Class.newInstance0(Class.java:350)
>	at java.lang.Class.newInstance(Class.java:303)
>	at org.omg.CORBA.ORB.create_impl(ORB.java:295)
>	... 16 more
>Caused by: org.omg.CORBA.BAD_PARAM: Tried to register duplicate service context  vmcid: 0x0  minor code: 0  completed: No
>	at com.sun.corba.se.spi.servicecontext.ServiceContextRegistry.register(ServiceContextRegistry.java:54)
>	at com.sun.corba.se.impl.orb.ORBConfiguratorImpl.initServiceContextRegistry(ORBConfiguratorImpl.java:428)
>	at com.sun.corba.se.impl.orb.ORBConfiguratorImpl.configure(ORBConfiguratorImpl.java:134)
>	at com.sun.corba.se.impl.orb.ORBImpl.postInit(ORBImpl.java:483)
>	... 31 more
>Dec 6, 2005 5:10:06 PM com.sas.services.connection.ClusterEnvelope getConnection
>SEVERE: no more servers in cluster
>Dec 6, 2005 5:10:06 PM com.sas.services.connection.ClusterEnvelope getConnection
>SEVERE: no more servers in cluster
>com.sas.tools.testdriver.TestDriverException: com.sas.services.connection.FatalConnectionFactoryException: can't instantiate default ORB implementation com.sun.corba.se.impl.orb.ORBSingleton
>	at com.sas.tools.testdriver.Context.reConnect(Context.java:453)
>	at com.sas.tools.testdriver.JTestThread.run(JTestThread.java:38)
>Caused by: com.sas.services.connection.FatalConnectionFactoryException: can't instantiate default ORB implementation com.sun.corba.se.impl.orb.ORBSingleton
>	at com.sas.services.connection.ClusterEnvelope.getConnection(ClusterEnvelope.java:92)
>	at com.sas.services.connection.AggregationKernel.getConnection(AggregationKernel.java:163)
>	at com.sas.services.connection.ConnectionFactoryShell.getConnection(ConnectionFactoryShell.java:56)
>	at com.sas.services.connection.ConnectionFactoryShell.getConnection(ConnectionFactoryShell.java:39)
>	at com.sas.tools.testdriver.Context.makeConnection(Context.java:1372)
>	at com.sas.tools.testdriver.Context.reConnect(Context.java:420)
>	... 1 more
>Caused by: org.omg.CORBA.INITIAL

                                    

Comments
EVALUATION

The private static fullORB variable in ORBSingleton does not call the method set_parameters() in thread-safe manner. Hence, there is a data corruption while multiple threads trying to set the parameters of ORBSingleton's fullORB.
                                     
2006-12-04



Hardware and Software, Engineered to Work Together