Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5305

java.util.ConcurrentModificationException when starting Axis2 OSGi bundle

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.6.2
    • None
    • modules
    • Mac OS X 10.7.3
      Java 1.6.0_31
      Equinox 3.7.2
      Felix Configuration Admin Service 1.2.8
      org.apache.axis2.osgi-1.6.2

    Description

      There is a race condition during the Axis2 bundle's startup.

      1) The Axis2 bundle Activator creates and starts OSGiConfigurationContextFactory, which in turn registers a ManagedService.
      2) After creating and starting the managed service it invokes updated() on that service (see org.apache.axis2.osgi.internal.Activator#start()).

      Problem is, if the configuration admin service is running it will listen for ManagedService registrations like the one in 1) above and it will spin up a thread that will also call the ManagedService updated() method. This means that two threads are calling into OSGiConfigurationContextFactory#updated() simultaneously.

      This in turn means that while one thread is calling open() on the BundleTracker another thread is calling addRegistry(). In BundleTracker#open() the code spins through the list of registries and this is where the exception happens.

      Caused by: java.util.ConcurrentModificationException
      at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
      at java.util.AbstractList$Itr.next(AbstractList.java:343)
      at org.apache.axis2.osgi.deployment.tracker.BundleTracker.open(BundleTracker.java:121)
      at org.apache.axis2.osgi.deployment.OSGiConfigurationContextFactory.updated(OSGiConfigurationContextFactory.java:113)
      at org.apache.axis2.osgi.internal.Activator.start(Activator.java:48)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
      ... 33 more

      If I stop the configuration admin service and start the Axis2 bundle it works. This is because the 2nd thread is not calling into the ManagedService's updated() method. This (shutting down the config admin service to start another bundle), however, is not a viable workaround as it is totally unreasonable to require this.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rmayfiel Rich Mayfield
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: