[jboss-osgi-issues] [JBoss JIRA] Created: (JBOSGI-479) Race condition when registering services in multiple threads

David Bosschaert (JIRA) jira-events at lists.jboss.org
Thu Jul 14 11:48:23 EDT 2011


Race condition when registering services in multiple threads
------------------------------------------------------------

                 Key: JBOSGI-479
                 URL: https://issues.jboss.org/browse/JBOSGI-479
             Project: JBoss OSGi
          Issue Type: Bug
      Security Level: Public (Everyone can see)
            Reporter: David Bosschaert
            Assignee: David Bosschaert


When registering multiple services with the same service name a race condition occurs. This is exposed when running the Service Performance tests (e.g. org.jboss.osgi.test.performance.service.arq.Service100TestCase).

The problem boils down to the fact that two threads race to obtain a service controller for the same name. One of them wins, the other fails with this exception:

org.jboss.msc.service.DuplicateServiceException: Service jbosgi.service."org.jboss.osgi.test.performance.service.SvcCls1" is already registered
	at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:154)
	at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:226)
	at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:560)
	at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201)
	at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2194)
	at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307)
	at org.jboss.osgi.framework.internal.ServiceManagerPlugin.registerService(ServiceManagerPlugin.java:180)
	at org.jboss.osgi.framework.internal.AbstractBundleContext.registerService(AbstractBundleContext.java:305)
	at org.jboss.osgi.framework.internal.AbstractBundleContext.registerService(AbstractBundleContext.java:297)
	at org.jboss.osgi.test.performance.service.CreateAndLookupBenchmark.runThread(CreateAndLookupBenchmark.java:79)
	at org.jboss.osgi.test.performance.service.CreateAndLookupBenchmark.runThread(CreateAndLookupBenchmark.java:41)
	at org.jboss.osgi.test.performance.AbstractThreadedBenchmark$1.run(AbstractThreadedBenchmark.java:91)
	at java.lang.Thread.run(Thread.java:680)


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-osgi-issues mailing list