Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 309792 - [registry] resetting Target Platform - ConcurrentModificationException and ArrayIndexOutOfBoundsException
Summary: [registry] resetting Target Platform - ConcurrentModificationException and Ar...
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Components (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X
: P3 major (vote)
Target Milestone: Juno   Edit
Assignee: Oleg Besedin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 375945 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-20 08:04 EDT by ekkehard gentz CLA
Modified: 2014-01-28 12:12 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ekkehard gentz CLA 2010-04-20 08:04:37 EDT
OSX 10.6.3
Eclipse SDK M6, osx-cocoa-64
with I-Build 20100414

today I had it some times that resetting the target platform causes exceptions
(preferences - target platform - reload - OK

at first I got a ConcurrentModificationException:

java.util.ConcurrentModificationException
	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
	at java.util.HashMap$ValueIterator.next(HashMap.java:822)
	at java.util.AbstractCollection.toArray(AbstractCollection.java:171)
	at org.eclipse.core.internal.registry.ExtensionRegistry.getAllContributors(ExtensionRegistry.java:1358)
	at org.eclipse.pde.internal.core.PDERegistryStrategy$ModelListener.modelsChanged(PDERegistryStrategy.java:80)
	at org.eclipse.pde.internal.core.PluginModelManager.fireDelta(PluginModelManager.java:314)
	at org.eclipse.pde.internal.core.PluginModelManager.modelsChanged(PluginModelManager.java:225)
	at org.eclipse.pde.internal.core.PluginModelManager.resetState(PluginModelManager.java:984)
	at org.eclipse.pde.internal.core.TargetPlatformResetJob.run(TargetPlatformResetJob.java:39)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

restarted eclipse, did the same this time it works.
did some more tests - then I got a ArrayIndexOutOfBoundsException:

java.lang.ArrayIndexOutOfBoundsException: 8
	at org.eclipse.core.internal.registry.ExtensionRegistry.removeExtension(ExtensionRegistry.java:598)
	at org.eclipse.core.internal.registry.ExtensionRegistry.removeExtensionsAndExtensionPoints(ExtensionRegistry.java:625)
	at org.eclipse.core.internal.registry.ExtensionRegistry.basicRemove(ExtensionRegistry.java:241)
	at org.eclipse.core.internal.registry.ExtensionRegistry.remove(ExtensionRegistry.java:570)
	at org.eclipse.core.internal.registry.ExtensionRegistry.removeContributor(ExtensionRegistry.java:555)
	at org.eclipse.pde.internal.core.PDERegistryStrategy$ModelListener.modelsChanged(PDERegistryStrategy.java:83)
	at org.eclipse.pde.internal.core.PluginModelManager.fireDelta(PluginModelManager.java:314)
	at org.eclipse.pde.internal.core.PluginModelManager.modelsChanged(PluginModelManager.java:225)
	at org.eclipse.pde.internal.core.PluginModelManager.resetState(PluginModelManager.java:984)
	at org.eclipse.pde.internal.core.TargetPlatformResetJob.run(TargetPlatformResetJob.java:39)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 ekkehard gentz CLA 2010-04-20 08:15:37 EDT
BTW: I did my tests with reloading Target Platforms because I worked on description of Bug 309795 which causes me always to reload the Target Platform after restarting eclipse and I wanted to test it again in a new installation.
Comment 2 ekkehard gentz CLA 2010-05-20 13:53:52 EDT
using SDK 3.6 RC1 - from time to time I'm still getting these exceptions while resetting the target platform. trying again it mostly works.

java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
at java.util.HashMap$ValueIterator.next(HashMap.java:822)
at java.util.AbstractCollection.toArray(AbstractCollection.java:171)
at org.eclipse.core.internal.registry.ExtensionRegistry.getAllContributors(ExtensionRegistry.java:1358)
at org.eclipse.pde.internal.core.PDERegistryStrategy$ModelListener.modelsChanged(PDERegistryStrategy.java:80)
at org.eclipse.pde.internal.core.PluginModelManager.fireDelta(PluginModelManager.java:355)
at org.eclipse.pde.internal.core.PluginModelManager.modelsChanged(PluginModelManager.java:255)
at org.eclipse.pde.internal.core.PluginModelManager.resetState(PluginModelManager.java:1042)
at org.eclipse.pde.internal.core.TargetPlatformResetJob.run(TargetPlatformResetJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 3 Curtis Windatt CLA 2012-04-03 12:11:19 EDT
*** Bug 375945 has been marked as a duplicate of this bug. ***
Comment 4 Olivier Thomann CLA 2012-04-03 12:20:31 EDT
I am wasting hours to try to recover from this failure. Very annoying!
Comment 5 Olivier Thomann CLA 2012-04-13 11:43:14 EDT
It looks like not all accesses to getContributors() are synchronized. For example, org.eclipse.core.internal.registry.ExtensionRegistry#getAllContributors() accesses the contributors.
It looks like org.eclipse.core.internal.registry.RegistryObjectManager.getContributors() is not synchronized when other accesses to the contributor collection are. Isn't this inconsistent ?
Comment 6 Curtis Windatt CLA 2012-04-24 15:20:28 EDT
Moving to Equinox for comment.

RegistryObjectManager synchronizes getContributor(String id) but not getContributors().  getContributor also checks if the contributor is marked as removed, while getContributors() does not.

PDE only uses the method in a single location (MPDERegistryStrategy).  We get the list of contributors and remove a contributor that has a name match to a removed PDE model.
Comment 7 Thomas Watson CLA 2012-04-25 10:18:25 EDT
Oleg, can you have a look?
Comment 8 Martin Lippert CLA 2012-04-25 11:25:37 EDT
Don't know if this is related, but I get this stack trace in the error log when running juno m6:

java.util.ConcurrentModificationException
	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
	at java.util.HashMap$ValueIterator.next(HashMap.java:822)
	at org.eclipse.ui.internal.registry.WorkingSetRegistry.getUpdaterDescriptorsForNamespace(WorkingSetRegistry.java:159)
	at org.eclipse.ui.internal.AbstractWorkingSetManager.bundleChanged(AbstractWorkingSetManager.java:672)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Comment 9 Martin Lippert CLA 2012-04-25 11:27:04 EDT
Hmmm... looking at it in more detail it looks like platform UI, sorry for bothering you here...
Will take a look in the platform UI area...
Comment 10 Oleg Besedin CLA 2012-04-27 10:34:19 EDT
I added a synchronization which should help. Note that I can not reproduce the problem so I can't really verify if it is fixed or not.

Git reference:

http://git.eclipse.org/c/equinox/rt.equinox.bundles.git/commit/?id=b5bbb5ebdec5295187718a43e1de06dd5d5e547a

Tentatively marking as fixed, please reopen if you get this again on builds >= 20120428.
Comment 11 James Fry CLA 2014-01-28 10:40:11 EST
My team are regularly getting a java.util.ConcurrentModificationException when setting an updated target platform. It seems to happen when the target is reloaded, and the "Apply" followed by the "OK" buttons are pressed (resulting in two jobs being scheduled).

Should this be raised as a new bug?

Stack trace:

java.util.ConcurrentModificationException
	at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
	at java.util.ArrayList$Itr.next(Unknown Source)
	at org.eclipse.pde.internal.core.RequiredPluginsClasspathContainer.computePluginEntries(RequiredPluginsClasspathContainer.java:117)
	at org.eclipse.pde.internal.core.RequiredPluginsClasspathContainer.getClasspathEntries(RequiredPluginsClasspathContainer.java:95)
	at org.eclipse.jdt.internal.core.ClasspathEntry.validateClasspathEntry(ClasspathEntry.java:1959)
	at org.eclipse.jdt.internal.core.ClasspathEntry.validateClasspathEntry(ClasspathEntry.java:1908)
	at org.eclipse.jdt.internal.core.ClasspathValidation.validate(ClasspathValidation.java:72)
	at org.eclipse.jdt.internal.core.ChangeClasspathOperation.classpathChanged(ChangeClasspathOperation.java:51)
	at org.eclipse.jdt.internal.core.SetContainerOperation.executeOperation(SetContainerOperation.java:110)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:793)
	at org.eclipse.jdt.core.JavaCore.setClasspathContainer(JavaCore.java:5401)
	at org.eclipse.pde.internal.core.PluginModelManager.updateAffectedEntries(PluginModelManager.java:373)
	at org.eclipse.pde.internal.core.PluginModelManager.modelsChanged(PluginModelManager.java:282)
	at org.eclipse.pde.internal.core.PluginModelManager.resetState(PluginModelManager.java:1075)
	at org.eclipse.pde.core.target.LoadTargetDefinitionJob.performPlatformReset(LoadTargetDefinitionJob.java:607)
	at org.eclipse.pde.core.target.LoadTargetDefinitionJob.handleReload(LoadTargetDefinitionJob.java:584)
	at org.eclipse.pde.core.target.LoadTargetDefinitionJob.loadPlugins(LoadTargetDefinitionJob.java:310)
	at org.eclipse.pde.core.target.LoadTargetDefinitionJob.runInWorkspace(LoadTargetDefinitionJob.java:143)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Comment 12 Thomas Watson CLA 2014-01-28 11:13:34 EST
(In reply to James Fry from comment #11)
> My team are regularly getting a java.util.ConcurrentModificationException
> when setting an updated target platform. It seems to happen when the target
> is reloaded, and the "Apply" followed by the "OK" buttons are pressed
> (resulting in two jobs being scheduled).
> 
> Should this be raised as a new bug?
> 
> Stack trace:
> 
> java.util.ConcurrentModificationException
> 	at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
> 	at java.util.ArrayList$Itr.next(Unknown Source)
> 	at
> org.eclipse.pde.internal.core.RequiredPluginsClasspathContainer.
> computePluginEntries(RequiredPluginsClasspathContainer.java:117)

This should be a new bug opened against PDE->Core.
Comment 13 Curtis Windatt CLA 2014-01-28 12:12:52 EST
(In reply to James Fry from comment #11)
> java.util.ConcurrentModificationException
> 	at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
> 	at java.util.ArrayList$Itr.next(Unknown Source)
> 	at

This is Bug 409401, fixed in 4.4 M1.